Solr Spellcheck请求什么都不返回

时间:2014-12-23 14:24:30

标签: solr spell-checking

我实际上使用Solr 4.8.1并且我设置了拼写检查。索引后,请求不会返回任何建议。

在@ n0tting的建议之后,我修改了一些文件。

以下是步骤:

1- solrconfig.xml

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

    <lst name="spellchecker">
      <str name="classname">solr.IndexBasedSpellChecker</str>
      <str name="spellcheckIndexDir">./spellchecker</str>
      <str name="name">default</str>
      <str name="field">title_spellcheck</str>
      <str name="buildOnCommit">true</str>
    </lst>
  </searchComponent>

在标准requestHandler中添加一些配置:

<requestHandler name="standard" class="solr.StandardRequestHandler" default="true">
    <!-- default values for query parameters -->
    <lst name="defaults">
      <str name="echoParams">explicit</str>
      <int name="rows">10</int>

      <!-- Optional, must match spell checker's name as defined above, defaults to "default" -->
      <str name="spellcheck.dictionary">default</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">1</str>
    </lst>

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

2 schema.xml

定义拼写检查字段:

  <field name="title_spellcheck" type="phraseText" indexed="true" stored="false" multiValued="true" />

  <copyField source="title" dest="title_spellcheck"/>

3请求:

  .../select?q=recommend&defType=edismax&qf=title&spellcheck=true&spellcheck.build=true&spellcheck.q=recommend&spellcheck.collate=true

我没有得到任何结果的建议,<lst name="spellcheck">。任何人都可以给我一个建议吗?非常感谢。

参考文献:

https://cwiki.apache.org/confluence/display/solr/Spell+Checking

http://solr.pl/en/2011/05/23/%E2%80%9Ccar-sale-application%E2%80%9D-%E2%80%93-spellcheckcomponent-%E2%80%93-did-you-really-mean-that-part-5/

0 个答案:

没有答案