My app generates unique id for each row to index in lucene and save to database.
One sutation is if there is and row have the same id,I want to update it,not insert an new row and index.
How to do that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is exactly the purpose of the IndexWrite#updateDocument method. The first argument is the term that must be unique in your index.
For example,
will ensure that
docis the only document with id 42 in your index.