标签:rms iss last table cell ber missing rtm 1.3
solr查询string类型时,有时需要使之不区分大小写( case insensitive),这时,就需要重新定义数据类型: 如统一转化为小写进行查询:
|
1
2
3
4
5
6
7
8
|
<fieldType name="string_ci" class="solr.TextField" sortMissingLast="true" omitNorms="true"> <analyzer> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory" /> </analyzer> </fieldType><field name="code" type="string_ci" indexed="true" stored="true" /> |
因string类型为值是可不变的,因此此次使用TextField (string field type for fields that contain structured values that shouldn’t be altered in any way)
注意:上面string_ci类型的field如果做facet时,得到的值将都是小写的,可能不符合实际需求。 因此,如果需要facet,需使用copyField再定义一个string类型的字段。 如:
|
1
2
3
|
<field name="code_cp" type="string" indexed="true" stored="false" /> <copyField source="code" dest="code_cp"/> |
对code_cp进行facet则行。
solr忽略大小写配置,在schema.xml中,对
<filterclass="solr.xxxxx" ignoreCase="true"expand="true"/>
中,对ignoreCase进行配置,如果为true,表示转化为小写匹配,及忽略大小写
标签:rms iss last table cell ber missing rtm 1.3
原文地址:https://www.cnblogs.com/cuihongyu3503319/p/9505148.html