Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you read from a lucene index while updating the index

Tags:

lucene

I can't find a straightforward yes or no answer to this! I know I can send multiple reads in parallel but can I query an index while a seperate process/thread is updating it?

like image 523
Matt Avatar asked Aug 18 '09 23:08

Matt


1 Answers

It's been a while since I used Lucene. However, assuming you are talking about the Java version, the FAQ has this to say:

Does Lucene allow searching and indexing simultaneously?

Yes. However, an IndexReader only searches the index as of the "point in time" that it was opened. Any updates to the index, either added or deleted documents, will not be visible until the IndexReader is re-opened. So your application must periodically re-open its IndexReaders to see the latest updates. The IndexReader.isCurrent() method allows you to test whether any updates have occurred to the index since your IndexReader was opened.

like image 76
Matt Solnit Avatar answered Oct 02 '22 09:10

Matt Solnit