我有各种文本字段,有时它们的值在其中有超大/短划线,例如欧米加3。现在,当我搜索'Omega'或甚至'Omega-'时,我得到了相关的结果,但是当我搜索'Omega-3'时,我得到零结果。
在'WordDelimiterFilterFactory'中设置catenateAll = 1会解决此问题吗?如果是,那么我应该将它设置为1:查询时间和索引时间?或者我还需要做些什么来解决这个问题?谢谢!
以下是定义文本字段类型的模式部分。
<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1" />
<filter class="solr.LowerCaseFilterFactory" />
<filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt" />
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory" />
<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.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1" />
<filter class="solr.LowerCaseFilterFactory" />
<filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt" />
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>
答案 0 :(得分:3)
Dashes是Solr / Lucene中的特殊字符。你需要用\
来逃避它们答案 1 :(得分:0)