Thanks Ian, and Mike -- the code below was the result of badly copying
the Javadocs in exasperation and panic: all points taken with gratitude.
Cheers
Lee
On 04/03/2011 16:40, Ian Lea wrote:
Looks basically OK to me. I wonder if you need the isCurrent() check
as well as if (newReader != reader) but shouldn't do any harm.
Likewise there doesn't seem much point in reassigning reader and
creating a new searcher if newReader is the same as reader. But I
don't think that either of those would cause new entries not to be
picked up.
I'd ask for some evidence and/or check that the new entries really
have been added.
--
Ian.
On Fri, Mar 4, 2011 at 1:20 PM, Lee Goddard<lee...@gmail.com> wrote:
Hello list,
Does this look correct? I am told it is not functioning, in that new
entries to the index are not being picked-up?
Thanks
Lee
try {
if (! reader.isCurrent()){
IndexReader newReader = reader.reopen();
if (newReader != reader) {
// reader was reopened
searcher.close();
reader.close();
}
reader = newReader;
searcher = new IndexSearcher(reader);
if (searcher == null) throw new ServletException( "searcher
is null (init a)" );
}
} catch (CorruptIndexException e){
throw new ServletException( "Could not refresh reader?
"+e.getMessage() );
} catch (IOException e){
throw new ServletException( "Could not refresh reader?
"+e.getMessage() );
} catch (Exception e){
throw new ServletException( "Could not re-open reader?
"+e.getMessage() );
}
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org