由于拼写检查索引目录中的write.lock,Solr核心无法初始化

时间:2019-01-17 14:34:26

标签: solr spell-checking solrconfig

尝试初始化Solr核心时遇到锁定问题:

SolrCore初始化失败:

MySolrCore:org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:org.apache.lucene.store.LockObtainFailedException:该虚拟机持有的锁:C:\ solr-6.0.1 \ server \ solr \ MySolrCore \ data \ analyzingInfixSuggesterIndexDir \ write.lock

我正在尝试在此核心上实现多个拼写检查器,但出现此锁定错误。

尝试不同方法的一些有趣注释:

我尝试将writeLockTimeout延长到30秒,但没有执行任何操作。

没有任何spellcheckIndexDir文件夹被创建。我添加了它们,以解决锁定问题。我什至尝试手动创建它们,并且没有将文件添加到其中。

如果我注释掉其中一个组件和处理程序,则另一个可以工作。

如果我注释掉使用了AnalysisInfixLookupFactory的拼写检查器,则使用WFSTLookupFactory的两个拼写检查器和两个处理程序都可以工作。但是,不会创建spellcheckIndexDir。

如何解决锁定问题?我认为,如果我可以指定所有可正常工作的spellcheckIndexDir,则索引将位于不同的文件夹中,并且不会有锁。感谢您的帮助!

这是两个字段的Solr配置搜索组件和处理程序。

  <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>

1 个答案:

答案 0 :(得分:0)

我需要使用indexPath而不是spellcheckIndexDir。现在正在工作。

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