You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Marc Sturlese <ma...@gmail.com> on 2011/06/15 21:06:29 UTC

Re: problem with the new IndexSearcher when snpainstaller (and commit script) happen [SOLVED]

I've found the problem in case someone is interested.
It's because of the indexReader.reopen(). If it is enabled, when opening a
new searcher due to the commit, this code is executed (in
SolrCore.getSearcher(boolean forceNew, boolean returnSearcher, final
Future[] waitSearcher)):
      ...
      if (newestSearcher != null && solrConfig.reopenReaders
          && indexDirFile.equals(newIndexDirFile)) {
        IndexReader currentReader = newestSearcher.get().getReader();
        IndexReader newReader = currentReader.reopen();

        if (newReader == currentReader) {
          currentReader.incRef();
        }

        tmp = new SolrIndexSearcher(this, schema, "main", newReader, true,
true);
 
      } else {
        IndexReader reader =
getIndexReaderFactory().newReader(getDirectoryFactory().open(newIndexDir),
true);
        tmp = new SolrIndexSearcher(this, schema, "main", reader, true,
true);
      }
      ...

If the names of the segments haven't changed, IndexReader.reopen thinks that
they haven't actually changed (but they have in my case as index files have
same name but have different docs at the same time) so instead of opening
new reader for the segments, it gives back the same one and changes can't be
seen by the new IndexSearcher.
Knowing that performance gets worse, disabling reopen in solrconfig.xml
solves the problem (and is still better performance that reloading the whole
core).
Does someone knows that this still happen on Lucene 3.2?

--
View this message in context: http://lucene.472066.n3.nabble.com/problem-with-the-new-IndexSearcher-when-snpainstaller-and-commit-script-happen-tp3066902p3068956.html
Sent from the Solr - User mailing list archive at Nabble.com.