我正在尝试在solr中使用部分单词匹配。
所以我有这样的架构设置:
<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<!-- in this example, we will only use synonyms at query time
<filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
-->
<!-- Case insensitive stop word removal.
enablePositionIncrements=true ensures that a 'gap' is left to
allow for accurate phrase queries.
-->
<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.EnglishPorterFilterFactory" protected="protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
<filter class="solr.NGramFilterFactory" minGramSize="2" maxGramSize="1000" side="front" />
<filter class="solr.NGramFilterFactory" minGramSize="2" maxGramSize="1000" side="back" />
</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"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
<field name="key" type="string" indexed="false" stored="true" required="true" />
<field name="uid" type="string" indexed="true" stored="true" required="true" />
<field name="organisationid" type="string" indexed="true" stored="true" required="false" />
<field name="organisationname" type="text" indexed="true" stored="true" required="false" />
<field name="organisationcleanname" type="text" indexed="true" stored="true" required="false" />
<field name="practiceareas" type="string" indexed="true" stored="true" required="false" multiValued="true" />
<field name="subeditions" type="string" indexed="true" stored="true" required="false" multiValued="true" />
我已将我想要的所有数据编入索引,并拥有一些组织名称,例如:
当我使用以下搜索进行搜索时:(organisationname:king OR organisationcleanname:king) AND practiceareas:20
轻轻地黑客攻击不会回到结果中(是的,其实践区域为20)。我是否错误地设置了NGram?