Eric, Thanks for your advise. I implement a version count to sych the index and search.
2007/12/27, Erick Erickson <[EMAIL PROTECTED]>: > > If you search the mail archives, you'll find many discussions > of the fact that when you open an index reader, it takes a > snapshot of the index and subsequent modifications to the > index are not available until the searcher is closed and re-opened. > > It is NOT a good idea to open a new reader every time you search, > as this is an expensive operation. You have to reach some > compromise between absolutely up-to-date results and how > much closing/opening of your readers you can afford. > > A bunch of approaches are discussed in the archives, so one of > those discussions may parallel your situation. Otherwise, you > need to give us some idea of your constraints before anyone can > suggest an approach. > > Best > Erick > > On Dec 27, 2007 8:59 AM, Zhou Qi <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > > I encounter a strange probelm. To improve performance, I open the > > indexreader at the start time and reuse it in later search. I have > another > > process running to do online indexing. The search service and indexing > > service is accessing the same index folder. But I found out the search > > service only returns old documents. That is to say, my index reader did > > not > > refresh the index folder for up-to-date index. If it acutally works like > > that in lucene, should I try to open the index to init the indexreader > > everytime I do search? > > > > Thanks > > >