2011-10-21 58 views
1

当我搜索这样:q = * 6205 *我得到更多的结果,然后搜索q = 6205,它是好的 但我的问题是: 当我搜索q = 6205-2RS或q = 6205 \ -2RS我得到了一些结果,但是当我把*放在搜索字符串中时,我没有收到任何结果(q = * 6205-2RS *或q = * 6205 \ -2RS *)为什么?apache搜索与*

我想搜索* 6205-2RS *,但我想solr搜索这个字符串也在项目名称的中间。

回答

1

通配符查询不会进行任何分析。
因此,当您使用通配符搜索6205-2RS时,它将按原样进行搜索,而不需要像小写过滤器,worddelimiters那样的任何分析。

什么是该领域的模式定义。它是一个文本字段还是一个字符串字段类型?

为text_general的定义如下 -

<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" /> 
    <!-- in this example, we will only use synonyms at query time 
    <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/> 
    --> 
    <filter class="solr.LowerCaseFilterFactory"/> 
    </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> 

在索引时间6205-2RS的标记生成器和下壳体滤波器在分析将生成的令牌6205,2rs
由于没有分析搜索过程中发生,它按原样搜索6205-2RS,并且不会找到任何结果。

将字段类型更改为字符串,并且应该与结果匹配。

+0

该字段的类型是“text_general” – krinn

+0

感谢您的答案,我需要在改变类型后重新索引整个索引吗?或者只是重新启动apache solr? – krinn

+0

如果更改字段类型,则需要重新索引。 – Jayendra