0

我在这个 Solr 中遇到了这个问题: Solr 只能根据数据库中的文件进行拼写检查并给出建议。但是,我想添加一个英文字典,所以即使数据库中不存在这个词,Solr 也可以根据英文字典给出建议。

我知道我必须使用 solrconfig.xml 中的 FileBasedSpellChecker 来执行此操作:

 <searchComponent name=”spellcheck” class=”solr.SpellCheckComponent”&gt;
         <lst name=”spellchecker”&gt;
             <str name=”classname”&gt;solr.FileBasedSpellChecker</str>
             <str name=”name”&gt;file</str>
             <str name=”sourceLocation”&gt;spellings.txt</str>
             <str name=”characterEncoding”&gt;UTF-8</str>
             <str name=”spellcheckIndexDir”&gt;./spellcheckerFile</str>
         </lst>
     </searchComponent>

但我不知道如何将 spellings.txt 上传到 Solr。我收到此错误:

{
  "responseHeader":{
    "status":404,
    "QTime":1},
  "response":{"numFound":0,"start":0,"docs":[]
  },
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"Specified dictionaries do not exist: file",
    "code":404}}

任何帮助将不胜感激。谢谢。

4

1 回答 1

0

简单的方法是将您spellings.txt的放在同一个文件夹中solrconfig.xml。如果我正确理解了这个问题。

于 2016-07-21T20:47:33.920 回答