Execute optimize() after delete index everytime ???
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Alan_Kam
Posted On:   Tuesday, January 21, 2003 06:34 PM

I'm using Lucene 1.2 to making a searching engine in my System. Everytime I update the record, I will check is there are any index add for these record before, if index exist, I will delete it then add index for the updated record. It works fine on the first ten times and the IndexReader return 1 of maxDoc() and numDocs() function. But when I update the record again, maxDoc() value will become 2 and IndexReader.document(0) is marked deleted(eg. IndexReader.isDeleted(0) return true ). Afterward, the maxDoc() and numDocs() value will also increase by 1 everytime I update the record again. I found that the problem can be solved by call optimize() after I delete the index, but i think it is time consuming. Is this any other methods to solve this problem ?    More>>

I'm using Lucene 1.2 to making a searching engine in my System. Everytime I update the record, I will check is there are any index add for these record before, if index exist, I will delete it then add index for the updated record. It works fine on the first ten times and the IndexReader return 1 of maxDoc() and numDocs() function.
But when I update the record again, maxDoc() value will become 2 and IndexReader.document(0) is marked deleted(eg. IndexReader.isDeleted(0) return true ). Afterward, the maxDoc() and numDocs() value will also increase by 1 everytime I update the record again. I found that the problem can be solved by call optimize() after I delete the index, but i think it is time consuming. Is this any other methods to solve this problem ?

Regards,

Alan

   <<Less
About | Sitemap | Contact