解决方案 »

  1.   

    第一次接触solr·····急求大神帮助,后面还有后续···配置了suggest,但是没有结果····
      

  2.   


    这个应该是   <str name="spellcheck.dictionary">default</str> 
    dictionary 设置的问题
    就是 前面对应的这个
     <lst name="spellchecker">
          <str name="name">default</str>
          <str name="field">text</str>
         ...
        </lst>
    这个是用 solr 中的 text 内容作为词典来做拼写检查的,具体我还没搞清楚
    用下面的 文件 dictionary 比较容易一点把这个 spellchecker (就是 requestHandler 中 的 spellcheck.dictionary)的注释去掉,
        sourceLocation  的 spellings.txt 在你的 solrhome 的conf文件夹下,
    跟 solrConfig.xml 在一起,在其中添加词语作为词典,一行只写一个。
    比如   iloveyou
           <lst name="spellchecker">
      <str name="name">file</str>
      <str name="classname">solr.FileBasedSpellChecker</str>
      <str name="sourceLocation">spellings.txt</str>
      <str name="characterEncoding">UTF-8</str>
      <str name="spellcheckIndexDir">spellcheckerFile</str>
    </lst>把 <str name="spellcheck.dictionary">default</str> 
    改为  <str name="spellcheck.dictionary">file</str> 
    启动 solr
    查询中 指定 spellcheck.dictionary=file
    spellcheck.build=true 这个参数只在第一次查询时使用
    http://localhost:8080/solr/spell?q=ilovyou&spellcheck=true&spellcheck.collate=true&spellcheck.dictionary=file&spellcheck.build=true可以试下看看,这是直接用文件内容作为 词典的
    默认的是使用 solr text 字段的内容作为字典。详情参考 solr wiki  SpellCheckComponent
    http://wiki.apache.org/solr/SpellCheckComponent/