最近我从solr 4迁移到了6。
在solr 4中shinglefilterfactory
工作正常,我的移民就是
<fieldType name="text_shingle" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.ShingleFilterFactory" minShingleSize="2" maxShingleSize="5"
outputUnigrams="false" outputUnigramsIfNoShingles="false" />
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.ShingleFilterFactory" minShingleSize="2" maxShingleSize="5"
outputUnigrams="false" outputUnigramsIfNoShingles="false" />
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.PositionFilterFactory"/>
</analyzer>
</fieldType>
但是在更新到solr 6后,带状疱疹无效,架构如下,
<fieldType name="text_shingle" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.ShingleFilterFactory" minShingleSize="2" maxShingleSize="5"
outputUnigrams="false" outputUnigramsIfNoShingles="false" />
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.ShingleFilterFactory" minShingleSize="2" maxShingleSize="5"
outputUnigrams="false" outputUnigramsIfNoShingles="false" />
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
虽然在Analysis选项卡中显示了正确的shingle结果但是在queryParser中使用时它没有给出正确的结果
我的样本点击
http://localhost:8983/solr/shingel_test/select?q=one%20plus%20one&wt=xml&debugQuery=true&defType=edismax&qf=cust_shingle
它将解析的查询创建为:
<str name="rawquerystring">one plus one</str>
<str name="querystring">one plus one</str>
<str name="parsedquery">(+())/no_coord</str>
<str name="parsedquery_toString">+()</str>
<lst name="explain"/>
<str name="QParser">ExtendedDismaxQParser</str>