Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lucene: reopen indexreader after index

Tags:

lucene

when my search server start to run, it will load all of the index at once for all queries. However, it's still use the old index even if I rebuild the index. So I think the I should tell the indexReader of searcher to reopen index after the server rebuild the index, but how to implement it? Maybe use producer-consumer pattern? Although I can use indexReader.isCurrent() to check whether the index have changed, but I have to check this ever times to search or at some period. Is there any more efficient and real-time way?

like image 480
remy Avatar asked Mar 27 '12 08:03

remy


1 Answers

A convenient way to do what you are describing is to use Lucene's helper class SearcherManager. If you are interested in doing near-realtime search, you might also be interested in NRTManager.

There is a very nice blog article about these two classes on Mike McCandless' blog.

like image 175
jpountz Avatar answered Oct 19 '22 23:10

jpountz