2016-07-21 27 views
0

我遇到了這個問題:Solr:Solr只能拼寫檢查並根據數據庫中的文件提供建議。但是,我想添加一個英文字典,因此即使數據庫中不存在該字詞,Solr也可以根據英文字典提供建議。在Solr上傳詞典以進行拼寫檢查

我知道我必須這樣做solrconfig.xml中使用FileBasedSpellChecker:

<searchComponent name=」spellcheck」 class=」solr.SpellCheckComponent」> 
     <lst name=」spellchecker」> 
      <str name=」classname」>solr.FileBasedSpellChecker</str> 
      <str name=」name」>file</str> 
      <str name=」sourceLocation」>spellings.txt</str> 
      <str name=」characterEncoding」>UTF-8</str> 
      <str name=」spellcheckIndexDir」>./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}} 

任何幫助將不勝感激。謝謝。

回答

0

簡單的方法是將您的spellings.txt放在solrconfig.xml所在的文件夾中。如果我正確理解這個問題。

+0

是的,這也是我所猜測的。但問題是我正在使用Lucidworks Fusion,它建立在Solr和其他東西之上。 Fusion不會公開solrconfig在其目錄中的位置。我正在Fusion UI中訪問它。 –