lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lee Goddard <lee...@gmail.com>
Subject IndexReader.reopen() question
Date Fri, 04 Mar 2011 13:20:24 GMT
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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message