lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Li Li <fancye...@gmail.com>
Subject What will happen when one thread is closing a searcher while another is searching?
Date Tue, 06 Sep 2011 02:43:25 GMT
hi all,
     I am using spellcheck in solr 1.4. I found that spell check is not
implemented as SolrCore. in SolrCore, it uses reference count to track
current searcher. oldSearcher and newSearcher will both exist if oldSearcher
is servicing some query. But in FileBasedSpellChecker

  public void build(SolrCore core, SolrIndexSearcher searcher) {
    try {
      loadExternalFileDictionary(core.getSchema(),
core.getResourceLoader());
      spellChecker.clearIndex();
      spellChecker.indexDictionary(dictionary);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
  public void clearIndex() throws IOException {
    IndexWriter writer = new IndexWriter(spellIndex, null, true);
    writer.close();

    //close the old searcher
    searcher.close();
    searcher = new IndexSearcher(this.spellIndex);
  }

  it clear old Index and close current searcher. When other thread is doing
search and searcher.close() is called, will it cause problem? Or
searcher.close() has finished and new IndexSearch has not yet constructed.
When other thread try to do search, will it also be problematic?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message