模式文件中特殊字符的Solr字段类型声明

时间:2012-02-01 09:14:28

标签: search solr

我想存储建筑物&理由维护美术教师/导师类别名称,并在textTight

中将字段类型声明为schema.xml
<fieldType name="textTight" class="solr.TextField" positionIncrementGap="100" >
        <analyzer>
            <tokenizer class="solr.WhitespaceTokenizerFactory"/>
            <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
            <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
            <filter class="solr.WordDelimiterFilterFactory" ignoreCase="true"  splitOnCaseChange="1" generateWordParts="1" generateNumberParts="0" catenateWords="0" catenateNumbers="0" catenateAll="0"/> 
            <filter class="solr.LowerCaseFilterFactory"/>
            <!--<filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/> -->
             <filter class="solr.ShingleFilterFactory" maxShingleSize="2" outputUnigrams="true" outputUnigramIfNoNgram="true" />
            <!-- this filter can remove any duplicate tokens that appear at the same position - sometimes
                 possible with WordDelimiterFilter in conjuncton with stemming. -->
            <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
        </analyzer>
    </fieldType>

但在查询时 categoryname:building & grounds maintenance结果为零。字段类型声明需要哪些更改。请帮忙解决。

由于

1 个答案:

答案 0 :(得分:0)

您可能会尝试将类别存储为关键字(没有任何类型的标记生成器)。

实现这一目标的最简单方法是:

<fieldType name="keywords" class="solr.TextField" />

您也可以合并同义词。