solrspell-checkingsolrconfig

Solr core cannot initialize because of write.lock in spellcheck index directory


I am having a lock issue when trying to initialize a Solr core:

SolrCore Initialization Failures:

MySolrCore: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: org.apache.lucene.store.LockObtainFailedException: Lock held by this virtual machine: C:\solr-6.0.1\server\solr\MySolrCore\data\analyzingInfixSuggesterIndexDir\write.lock

I am trying to implement multiple spell checkers on this core and I get this lock error.

Some interesting notes from trying different approaches:

I tried extending the writeLockTimeout to 30 seconds and that did nothing.

None of the spellcheckIndexDir folders are getting created. I added them in hopes of fixing the lock issue. I even tried creating them manually, and no files were added to them.

If I comment out one of the components and handlers, the other one works.

If I comment out the spellecheckers that use the AnalyzingInfixLookupFactory then both of the spellcheckers that use the WFSTLookupFactory and both of the handlers work. However, the spellcheckIndexDir is not created.

How do I fix the lock issue? I think that if I can get all of the spellcheckIndexDir specified to work that the indexes will be located in different folders and there won't be a lock. Thanks for any help!

Here's my Solr config search components and handlers for the two fields.

  <searchComponent name="NameSuggest" class="solr.SpellCheckComponent">
    <lst name="spellchecker">
      <str name="name">NameFST</str>
      <str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
      <str name="lookupImpl">org.apache.solr.spelling.suggest.fst.WFSTLookupFactory</str>
      <str name="field">NameFST</str>
      <int name="minQueryLength">3</int>
      <str name="buildOnCommit">true</str>
      <str name="buildOnOptimize">true</str>
      <str name="suggestAnalyzerFieldType">suggest_phrase</str>
      <str name="spellcheckIndexDir">./NameFSTSuggestIndexDir</str>
    </lst>
    <lst name="spellchecker">
      <str name="name">NameAI</str>
      <str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
      <str name="lookupImpl">org.apache.solr.spelling.suggest.fst.AnalyzingInfixLookupFactory</str>
      <str name="field">NameAI</str>
      <int name="minQueryLength">3</int>
      <str name="buildOnCommit">true</str>
      <str name="buildOnOptimize">true</str>
      <str name="suggestAnalyzerFieldType">suggest_phrase</str>
      <str name="spellcheckIndexDir">./NameAISuggestIndexDir</str>
    </lst>
    <str name="queryAnalyzerFieldType">suggest_phrase</str>
  </searchComponent>
  <requestHandler class="org.apache.solr.handler.component.SearchHandler" name="/NameSuggest" startup="lazy">
    <lst name="defaults">
      <str name="spellcheck">true</str>
      <str name="spellcheck.dictionary">NameFST</str>
      <str name="spellcheck.dictionary">NameAI</str>
      <str name="spellcheck.onlyMorePopular">true</str>
      <str name="spellcheck.count">10</str>
      <str name="spellcheck.collate">false</str>
      <str name="spellcheck.extendedResults">true</str>
    </lst>
    <arr name="components">
      <str>NameSuggest</str>
    </arr>
  </requestHandler>



  <searchComponent name="DescriptionSuggest" class="solr.SpellCheckComponent">
    <lst name="spellchecker">
      <str name="name">DescriptionFST</str>
      <str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
      <str name="lookupImpl">org.apache.solr.spelling.suggest.fst.WFSTLookupFactory</str>
      <str name="field">DescriptionFST</str>
      <int name="minQueryLength">3</int>
      <str name="buildOnCommit">true</str>
      <str name="buildOnOptimize">true</str>
      <str name="suggestAnalyzerFieldType">suggest_phrase</str>
      <str name="spellcheckIndexDir">./DescriptionFSTSuggestIndexDir</str>
    </lst>
    <lst name="spellchecker">
      <str name="name">DescriptionAI</str>
      <str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
      <str name="lookupImpl">org.apache.solr.spelling.suggest.fst.AnalyzingInfixLookupFactory</str>
      <str name="field">DescriptionAI</str>
      <int name="minQueryLength">3</int>
      <str name="buildOnCommit">true</str>
      <str name="buildOnOptimize">true</str>
      <str name="suggestAnalyzerFieldType">suggest_phrase</str>
      <str name="spellcheckIndexDir">./DescriptionAISuggestIndexDir</str>
    </lst>
    <str name="queryAnalyzerFieldType">suggest_phrase</str>
  </searchComponent>
  <requestHandler class="org.apache.solr.handler.component.SearchHandler" name="/DescriptionSuggest" startup="lazy">
    <lst name="defaults">
      <str name="spellcheck">true</str>
      <str name="spellcheck.dictionary">DescriptionFST</str>
      <str name="spellcheck.dictionary">DescriptionAI</str>
      <str name="spellcheck.onlyMorePopular">true</str>
      <str name="spellcheck.count">10</str>
      <str name="spellcheck.collate">false</str>
      <str name="spellcheck.extendedResults">true</str>
    </lst>
    <arr name="components">
      <str>DescriptionSuggest</str>
    </arr>
  </requestHandler>


Solution

  • Instead of spellcheckIndexDir I needed to use indexPath. It's working now.

    <!-- <str name="spellcheckIndexDir">./NameAISuggestIndexDir</str> -->
    <str name="indexPath">./NameAISuggestIndexDir</str>