我正在尝试对一些索引数据运行拼写检查。我最初想出了如何做到这一点,但我搞砸了一些配置,现在它说“所有检查器都需要使用相同的分析器”。我读过这是因为“字段”值被命名为不同的东西。我已将所有拼写检查组件拼写。我还有什么做错的。
我输入时收到该错误是
http://localhost:8080/solr/collection1/select?q=name%3Adoc&wt=json&indent=true&spellcheck=true&spellcheck.collate=true&spellcheck.build=true
我的 solrconfig.xml
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<!-- Optional, must match spell checker's name as defined above, defaults to "default" -->
<str name="spellcheck.dictionary">default</str>
<!-- Also generate Word Break Suggestions (Solr 4.0 see SOLR-2993) -->
<str name="spellcheck.dictionary">wordbreak</str>
<!-- omp = Only More Popular -->
<str name="spellcheck.onlyMorePopular">false</str>
<!-- exr = Extended Results -->
<str name="spellcheck.extendedResults">false</str>
<!-- The number of suggestions to return -->
<str name="spellcheck.count">10</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
<lst name="spellchecker">
<str name="name">default</str>
<!-- The classname is optional, defaults to IndexBasedSpellChecker -->
<str name="classname">solr.IndexBasedSpellChecker</str>
<str name="field">spell</str>
<!-- Optional, by default use in-memory index (RAMDirectory) -->
<str name="spellcheckIndexDir">./spellchecker</str>
<!-- Set the accuracy (float) to be used for the suggestions. Default is 0.5 -->
<str name="accuracy">0.7</str>
<!-- Require terms to occur in 1/100th of 1% of documents in order to be included in the dictionary -->
<float name="thresholdTokenFrequency">.0001</float>
</lst>
<!-- a spellchecker that can break or combine words. (Solr 4.0 see SOLR-2993) -->
<lst name="spellchecker">
<str name="name">wordbreak</str>
<str name="classname">solr.WordBreakSolrSpellChecker</str>
<str name="field">spell</str>
<str name="combineWords">true</str>
<str name="breakWords">true</str>
<int name="maxChanges">3</int>
</lst>
<!-- Example of using different distance measure -->
<lst name="spellchecker">
<str name="name">jarowinkler</str>
<str name="field">spell</str>
<!-- Use a different Distance Measure -->
<str name="distanceMeasure">org.apache.lucene.search.spell.JaroWinklerDistance</str>
<str name="spellcheckIndexDir">./spellchecker</str>
</lst>
<!-- This field type's analyzer is used by the QueryConverter to tokenize the value for "q" parameter -->
<str name="queryAnalyzerFieldType">textSpell</str>
</searchComponent>
<searchComponent class="solr.SpellCheckComponent" name="suggest">
<lst name="spellchecker">
<str name="name">spell</str>
<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
<str name="field">suggest</str>
<float name="threshold">0.005</float>
<str name="buildOnCommit">true</str>
</lst>
</searchComponent>
<requestHandler class="org.apache.solr.handler.component.SearchHandler" name="/suggest">
<lst name="defaults">
<str name="spellcheck">true</str>
<str name="spellcheck.dictionary">suggest</str>
<str name="spellcheck.onlyMorePopular">true</str>
<str name="spellcheck.count">5</str>
<str name="spellcheck.collate">true</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
我的 schema.xml
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="sku" type="text_en_splitting_tight" indexed="true" stored="true" omitNorms="true"/>
<field name="name" type="text_general" indexed="true" stored="true"/>
<field name="manu" type="text_general" indexed="true" stored="true" omitNorms="true"/>
<field name="cat" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="features" type="text_general" indexed="true" stored="true" multiValued="true"/>
<field name="includes" type="text_general" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" />
<field name="weight" type="float" indexed="true" stored="true"/>
<field name="price" type="float" indexed="true" stored="true"/>
<field name="popularity" type="int" indexed="true" stored="true" />
<field name="inStock" type="boolean" indexed="true" stored="true" />
<field name="store" type="location" indexed="true" stored="true"/>
堆栈跟踪
java.lang.IllegalArgumentException: All checkers need to use the
same Analyzer.\n\tat org.apache.solr.spelling.ConjunctionSolrSpellChecker.addChecker(
ConjunctionSolrSpellChecker.java:79)\n\tat org.apache.
solr.handler.component.SpellCheckComponent.getSpellChecker(SpellCheckComponent.java:501)
\n\tat org.apache.solr.handler.component.SpellCheckComponent.prepare(SpellCheckComponent.
java:122)\n\tat org.apache.solr.handler.component.SearchHandler.handleRequestBody
(SearchHandler.java:187)\n\tat org.apache.solr.handler.RequestHandlerBase.handleRequest
(RequestHandlerBase.java:135)\n\tat org.apache.solr.core.SolrCore.execute
(SolrCore.java:1904)\n\tat org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:659)
\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter
(SolrDispatchFilter.java:362)\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter
(SolrDispatchFilter.java:158)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:243)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:210)\n\tat org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:222)\n\tat org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:123)\n\tat org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:171)\n\tat org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:99)\n\tat org.apache.catalina.valves.AccessLogValve.invoke
(AccessLogValve.java:953)\n\tat org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:118)\n\tat org.apache.catalina.connector.CoyoteAdapter.service
(CoyoteAdapter.java:408)\n\tat org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
\n\tat org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process
(AbstractProtocol.java:589)\n\tat org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.runTask
(ThreadPoolExecutor.java:886)
\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)\n\tat java.lang.Thread.run(Thread.java:662)\n",
"code":500}}
任何帮助,将不胜感激。