具有facet的Solr spellCheck类型在facet.field期间引发异常:spell

时间:2018-12-19 09:32:27

标签: solr spell-checking facet

我对pellic类型的spell字段刻面有问题。我遇到了一个Exception during facet.field: spell异常,并且不确定是否可以实际使用此字段。

Solr版本:6.6.5

请求标头:

GET /solr/core_de/select?facet.field=spell&facet=on&indent=on&q=*:*&wt=json HTTP/1.1
Host: xxxx:8983
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

Solr请求处理程序:

<requestHandler name="/select" class="solr.SearchHandler">
    <lst name="defaults">
        <str name="defType">edismax</str>
        <str name="echoParams">explicit</str>
        <str name="qf">content^40.0 title^5.0 keywords^2.0 tagsH1^5.0 tagsH2H3^3.0 tagsH4H5H6^2.0 tagsInline^1.0</str>
        <str name="pf">content^2.0</str>
        <str name="df">content</str>
        <int name="ps">15</int>

        <str name="mm">2&lt;-35%</str>
        <str name="mm.autoRelax">true</str>

        <str name="hl.fl">title,content</str>
        <int name="hl.snippets">3</int>
        <str name="hl.mergeContiguous">true</str>
        <str name="hl.requireFieldMatch">true</str>

        <str name="f.content.hl.alternateField">content</str>
        <str name="f.content.hl.maxAlternateFieldLength">200</str>

        <str name="spellcheck">false</str>
        <str name="spellcheck.onlyMorePopular">false</str>
        <str name="spellcheck.extendedResults">false</str>
        <str name="spellcheck.count">1</str>
        <str name="spellcheck.dictionary">default</str>
        <str name="spellcheck.dictionary">wordbreak</str>

        <str name="wt">json</str>
        <str name="indent">true</str>
    </lst>

    <arr name="last-components">
        <str>spellcheck</str>
        <str>elevator</str>
    </arr>
</requestHandler>

solrconfig.xml中的拼写检查searchComponent

<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
    <str name="queryAnalyzerFieldType">textSpell</str>

    <lst name="spellchecker">
        <str name="name">default</str>
        <str name="field">spell</str>
        <str name="classname">solr.DirectSolrSpellChecker</str>
        <str name="distanceMeasure">internal</str>
        <float name="accuracy">0.5</float>
        <int name="maxEdits">2</int>
        <int name="minPrefix">1</int>
        <int name="maxInspections">5</int>
        <int name="minQueryLength">3</int>
        <float name="maxQueryFrequency">0.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">spell</str>
    </lst>
</searchComponent>

general_schema_fields.xml中的字段定义

<field name="spell" type="textSpell" indexed="true" stored="false" multiValued="true" />
<copyField source="title"    dest="spell" />
<copyField source="subTitle" dest="spell" />
<copyField source="content"  dest="spell" />

从solr源代码开始,该过程在以下位置引发异常:

https://github.com/apache/lucene-solr/blob/releases/lucene-solr/6.6.5/solr/core/src/java/org/apache/solr/request/SimpleFacets.java#L809

该异常的前几行:

org.apache.solr.common.SolrException: Exception during facet.field: spell
tat org.apache.solr.request.SimpleFacets.lambda$getFacetFieldCounts$0(SimpleFacets.java:809)
tat java.util.concurrent.FutureTask.run(FutureTask.java:266)
tat org.apache.solr.request.SimpleFacets$3.execute(SimpleFacets.java:742)
tat org.apache.solr.request.SimpleFacets.getFacetFieldCounts(SimpleFacets.java:818)
tat org.apache.solr.handler.component.FacetComponent.getFacetCounts(FacetComponent.java:330)
tat org.apache.solr.handler.component.FacetComponent.process(FacetComponent.java:274)
tat org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:296)
tat org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:173)
tat org.apache.solr.core.SolrCore.execute(SolrCore.java:2477)
tat org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:723)
tat org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:529)
tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:361)
tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:305)
tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1691)
tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)

克服标题等字段的问题是没有问题的。

我如何使其工作?

谢谢。

0 个答案:

没有答案