我是 Solr 的初学者,我的Soleserver索引中有以下集合:
{
"id": "book5",
"title": [
"Five point someone"
],
"author": "Chetan Bagat",
"genere": "fantasy",
"description": [
"An iit guide"
],
"comments": [
"good",
"excellent"
],
"publications": [
"swapnapublications",
"pb publications"
]
}
和
{
"id": "book1",
"title": [
"nightatcallcenter"
],
"author": "ChetanBagat",
"genere": "fiction",
"description": [
"Aniitguide"
],
"comments": [
"good",
"excellent"
],
"publications": [
"bangalorepublications",
"aswinpublications"
]
}
我的查询q =五点+点+某人失败
但我的查询
q = nightatcallcenter很好,为什么会这样?我怎样才能使第一个查询工作
我的架构:
<fields>
<field name="id" type="text_general" indexed="true" stored="true" required="true" multiValued="false" />
<field name="title" type="text_general" indexed="true" stored="true" multiValued="true"/
<field name="genere" type="text_general" indexed="true" stored="true"/>
<field name="description" type="text_general" indexed="true" stored="true" multiValued="true"/>
<field name="comments" type="text_general" indexed="true" stored="true" multiValued="true"/>
<field name="author" type="text_general" indexed="true" stored="true" />
<field name="publications" type="text_general" indexed="true" stored="true" multiValued="true" />
<copyField source='*' dest='fulltext'/>
<field name='fulltext' type='text_general' multiValued='true '/>
</fields>
答案 0 :(得分:1)
您遇到的问题是,使用text_general
时,您将创建一个令牌。当您搜索Five +point+someone
时,您正在寻找三个令牌:
您可以使用的干净解决方案是创建自定义text_general
,如下所示:
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
答案 1 :(得分:0)
感谢@alexf,tockenizer完美运作
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" >
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
</analyzer>
</fieldType>