我尝试使用Solr的Suggester
组件,但它提供了异常Unknown Search Component: spellcheck
。我使用solr版本3.6。我在solrconfig.xml
进行了更改,所以它看起来像这样
<searchComponent class="solr.SpellCheckComponent" name="suggester">
<lst name="spellchecker">
<str name="name">suggester</str>
<str name="field">name</str>
<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
<float name="threshold">0.005</float>
<str name="buildOnCommit">true</str>
<str name="spellcheckIndexDir">spellchecker</str>
</lst>
</searchComponent>
<requestHandler class="org.apache.solr.handler.component.SearchHandler" name="/suggester">
<lst name="defaults">
<str name="spellcheck">true</str>
<str name="spellcheck.dictionary">suggester</str>
<str name="spellcheck.count">10</str>
</lst>
<arr name="components">
<str>suggester</str>
</arr>
</requestHandler>
现在我保存了它并启动了solr但它出现500
错误。有一个很长的堆栈跟踪,就像这样
HTTP Status 500 - Severe errors in solr configuration. Check your log files for more detailed information on what may be wrong. If you want solr to continue after configuration errors, change: <abortOnConfigurationError>false</abortOnConfigurationError> in solr.xml ------------------------------------------------------------- org.apache.solr.common.SolrException: No cores were created, please check the logs for errors at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:172) at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:96) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295) at
---很多行---
还有一些
Caused by: org.apache.solr.common.SolrException: Unknown Search Component: spellcheck at org.apache.solr.core.SolrCore.getSearchComponent(SolrCore.java:893) at org.apache.solr.handler.component.SearchHandler.inform(SearchHandler.java:118) at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:527) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:594) ... 32 more
根据堆栈跟踪,Solr无法找到spellcheck
组件,但根据Solr wiki,此组件附带Solr版本&gt; 1.4。
答案 0 :(得分:2)
您似乎已将搜索组件命名为suggester
,而您的requestHandler正确引用它,因此可能不是问题所在。您是否可以在其余的solrconfig.xml中检查其他一些requestHandler 是否在其last-components部分或其他地方引用了名为spellcheck
的组件?这会引发错误,因为它无法再找到具有该名称的组件(它已重命名为suggester
)。
solrconfig的问题在于它附带了许多预先配置的搜索处理程序,如果你更改了一个项目的默认名称,它可能会导致引用它的处理程序出现问题。