我已经使用字段 fullName 索引了 2 个用户文档:
fullname=Matt Cain
fullName=Matt Harvey
当我搜索
fullName:Matt Harvey
马特凯恩这个词得到了更高的分数,但如果我搜索
fullName:matt OR fullName:harvey
然后马特哈维先来。
如何正确配置我的 schema.xml 以便 solr 正确处理它而无需手动中断查询?
这是我当前 schema.xml 中的一些相关部分
<fields>
<!-- general -->
<field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
<field name="type" type="text_general" indexed="true" stored="true" multiValued="false"/>
<field name="name" type="text_general" indexed="true" stored="true" multiValued="false"/>
<field name="_version_" type="long" indexed="true" stored="true"/>
<field name="firstName" type="text_general" indexed="true" stored="true"/>
<field name="lastName" type="text_general" indexed="true" stored="true"/>
<field name="fullName" type="text_general" indexed="true" stored="true"/>
<field name="email" type="text_general" indexed="true" stored="true"/>
<field name="workPlace" type="text_general" indexed="true" stored="true"/>
<field name="geoArea" type="text_general" indexed="true" stored="true"/>
<field name="gender" type="text_general" indexed="true" stored="true"/>
<field name="tags" type="text_general" indexed="true" stored="true" multiValued="true"/>
<field name="birthDate" type="date" indexed="true" stored="true"/>
<field name="followersCount" type="long" indexed="true" stored="true"/>
<field name="featuredLevel" type="int" indexed="true" stored="true" multiValued="false"/>
<field name="fbId" type="text_general" indexed="false" stored="true"/>
<field name="imageUrl" type="text_general" indexed="false" stored="true"/>
<field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>
<dynamicField name="*" type="ignored" multiValued="true"/>
</fields>
……
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.NGramFilterFactory" minGramSize="2" maxGramSize="15"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
如果还有其他部分需要回答这个问题,我很乐意发布它们。不想发布整个事情..谢谢