0

我将SnowballPorterFilterFactory用于索引和查询分析器。当我搜索“专业”这个词时。Solr 成功只找到包含“专业”的文章,但我想要“专业”“专业”...

这是schema.xml上的当前配置

<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="1" splitOnCaseChange="1"/>
        <filter class="solr.ASCIIFoldingFilterFactory" />
        <filter class="solr.SnowballPorterFilterFactory" language="French"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>

    </analyzer>
    <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="0"/>
        <filter class="solr.ASCIIFoldingFilterFactory" />
        <filter class="solr.SnowballPorterFilterFactory" language="French"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
    </analyzer>
</fieldType>
4

1 回答 1

0

正在发生的事情是搬运工过度使用您的查询。当您搜索关键字时,profession您的关键字会被归结为profess,而profession professionalprofessionalism 都存储在索引中profession

您要解决此问题的唯一真正方法是fieldType在不阻止查询的地方添加另一个。

就像是:

<fieldType name="text_unstemmed_query" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="1" splitOnCaseChange="1"/>
        <filter class="solr.ASCIIFoldingFilterFactory" />
        <filter class="solr.SnowballPorterFilterFactory" language="French"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
    </analyzer>
    <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="0"/>
        <filter class="solr.ASCIIFoldingFilterFactory" />
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
    </analyzer>
</fieldType>

使用如下复制字段:

<copyField source="your_text_field" dest="text_unstem_query_field"/>

于 2012-05-15T22:28:04.933 回答