Solr的拼写检查:不能显示的结果,总是收到同样的错误(Solr spellcheck: canno

2019-08-23 01:26发布

所以,林相当新的Solr的,也许我有这么多的认识问题。

什么我试着去,现在我的搜索栏做的,它的自我暗示。 例如,如果你写“glves”,结果应该是“手套”。 这是一个自动完成,其现在工作正常内。 但当然,当我输入“glves”,没有出现。

现在,当你写“手套”,所有对项目现场的单词“手套”的项目,会出现。 我想这也为术语“glves”。

这是我的schema.xml:

    <field name="_version_" type="long" indexed="true" stored="true"/>
    <field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>
    <field name="oxid" type="string" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="ean" type="string" indexed="true" required="false" />
    <field name="marken" type="text_en" indexed="true" stored="true" />
    <field name="item" type="text_en" indexed="true" stored="true" />
    <field name="shortdesc" type="text_de" indexed="true" stored="true" />
    <field name="price" type="float" indexed="true" stored="true" />
    <field name="picture" type="string" indexed="true" stored="true" />
    <field name="seourl" type="string" indexed="true" stored="true" />
    <field name="item_autocomplete" type="text_autocomplete" indexed="true" stored="false" />
    <field name="item_show" type="string" indexed="true" stored="false" />

上述领域中,是我的目的做工不错。 我需要指数为搜索领域是项目。

这就是我对我的solrconfig.xml中:

<searchComponent name="spellcheck" class="solr.SpellCheckComponent">

<str name="queryAnalyzerFieldType">item</str>

<!-- Multiple "Spell Checkers" can be declared and used by this
     component
  -->

<!-- a spellchecker built from a field of the main index -->
<lst name="spellchecker">
  <str name="name">default</str>
  <str name="field">item</str>
  <str name="classname">solr.DirectSolrSpellChecker</str>
    <str name="spellcheckIndexDir">./spellchecker</str>
  <str name="buildOnOptimize">true</str>
  <str name="buildOnCommit">true</str>
  <!-- the spellcheck distance measure used, the default is the internal levenshtein -->
  <str name="distanceMeasure">internal</str>
  <!-- minimum accuracy needed to be considered a valid spellcheck suggestion -->
  <float name="accuracy">0.5</float>
  <!-- the maximum #edits we consider when enumerating terms: can be 1 or 2 -->
  <int name="maxEdits">2</int>
  <!-- the minimum shared prefix when enumerating terms -->
  <int name="minPrefix">1</int>
  <!-- maximum number of inspections per result. -->
  <int name="maxInspections">5</int>
  <!-- minimum length of a query term to be considered for correction -->
  <int name="minQueryLength">4</int>
  <!-- maximum threshold of documents a query term can appear to be considered for correction -->
  <float name="maxQueryFrequency">0.01</float>
  <!-- uncomment this to require suggestions to occur in 1% of the documents
    <float name="thresholdTokenFrequency">.01</float>
  -->
</lst>

<!-- a spellchecker that can break or combine words.  See "/spell" handler below for usage -->
<lst name="spellchecker">
  <str name="name">wordbreak</str>
  <str name="classname">solr.WordBreakSolrSpellChecker</str>      
  <str name="field">name</str>
  <str name="combineWords">true</str>
  <str name="breakWords">true</str>
  <int name="maxChanges">10</int>
</lst>

但每次我做一个查询到Solr,即:

http://localhost:8983/solr/spell?spellcheck=true&qt=spellchecker&spellcheck.accuracy=0.8&spellcheck.collate=true&extendedResults=true+&q=glovs

我得到同样的回应:

<response><lst name="responseHeader"><int name="status">500</int><int name="QTime">2</int></lst><lst name="error"><str name="msg">All checkers need to use the same Analyzer.</str><str name="trace">java.lang.IllegalArgumentException: All checkers need to use the same Analyzer.
at org.apache.solr.spelling.ConjunctionSolrSpellChecker.addChecker(ConjunctionSolrSpellChecker.java:79)
at org.apache.solr.handler.component.SpellCheckComponent.getSpellChecker(SpellCheckComponent.java:475)
at org.apache.solr.handler.component.SpellCheckComponent.prepare(SpellCheckComponent.java:106)
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:187)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
at org.apache.solr.core.RequestHandlers$LazyRequestHandlerWrapper.handleRequest(RequestHandlers.java:242)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1797)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:637)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:343)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:141)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:365)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:722)
</str><int name="code">500</int></lst></response>

我尝试按照许多手册,提示老问题,这些论坛上,但我不是得到什么有用的我。

谢谢你的时间。

Answer 1:

我发现这个答案 ,帮我解决完全相同的错误消息类似的问题。 你的问题可能是你为不同的拼写检查的定义定义了两个不同的领域:

<str name="field">item</str> AND <str name="field">name</str>

这些都应该是平等的。 这是Solr的抱怨。



文章来源: Solr spellcheck: cannot show result, always receiving same error
标签: solr