我尝试使用 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 版本 > 1.4。