-1

当我搜索“啤酒”时,我得到了结果,但是当我搜索“蜜蜂”时,我没有得到任何结果。我无法搜索任何短于 4 个字符的单词。有没有办法让这成为可能?!

4

1 回答 1

0

检查您的 SOLR 配置conf/schema.xml并根据您的需求配置设置。更改后重建索引并重试。

这可能是这部分,但你必须“玩”设置。

试试这个配置作为例子:

<fieldType name="text" class="solr.TextField" omitNorms="false">

  <analyzer type="index">
          <tokenizer class="solr.WhitespaceTokenizerFactory"/>
          <filter class="solr.PhoneticFilterFactory" encoder="DoubleMetaphone" inject="true"/>

          <filter class="solr.WordDelimiterFilterFactory"
                  generateWordParts="1"
                  generateNumberParts="0"
                  catenateWords="1"
                  catenateNumbers="1"
                  catenateAll="1"
                  splitOnNumerics="0"
                  splitOnCaseChange="1"
                  preserveOriginal="1" />
          <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
          <filter class="solr.StopFilterFactory"
                  ignoreCase="true"
                  words="stopwords.txt"
                  enablePositionIncrements="true" />
          <filter class="solr.LowerCaseFilterFactory"/>
          <filter class="solr.SnowballPorterFilterFactory" language="German2" protected="protwords.txt"/>
          <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
          <filter class="solr.NGramFilterFactory" minGramSize="1" maxGramSize="42" /> 
  </analyzer>
  <analyzer type="query">
          <tokenizer class="solr.WhitespaceTokenizerFactory"/>
          <filter class="solr.StopFilterFactory"
                  ignoreCase="true"
                  words="stopwords.txt"
                  enablePositionIncrements="true" />
          <filter class="solr.LowerCaseFilterFactory"/>
          <filter class="solr.SnowballPorterFilterFactory" language="German2" protected="protwords.txt"/>
          <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  </analyzer>

</fieldType>
于 2013-02-10T13:17:04.960 回答