1. filed 的定义
定义一个 field,名字为 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" /> <!-- 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" /> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer> </fieldType>
2. fieldType 标签的属性说明
<fieldType name="date" class="solr.DatePointField" sortMissingLast="true" omitNorms="true"/>
主要分为:
* 通用属性
* 字段默认属性 可以在字段类型上指定,也可在单个字段上指定
部分属性说明:
indexed 是否已加入倒排索引,如果为false,则此字段搜索不到符合条件的文档
stored 意味着是否在结果中展示(也可通过 fl 控制是否在结果中显示)
sortMissingFirst/sortMissingLast 当使用该字段进行排序时,sortMissingLast = true 表示那些在该<field>上没有值的documents将被排在那些在该<field>上有值的documents之后。
multiValued 集合类型
<field name="executor" type="int" indexed="true" stored="true" multiValued="true" />
@Field private Set<Integer> executor;
查询结果
large 用于懒加载较大的值(超过512KB不进行缓存),此属性需要 stored="true"
并且 multiValued="false"。
参考
https://solr.apache.org/guide/8_8/overview-of-documents-fields-and-schema-design.html
原文:https://www.cnblogs.com/lemos/p/14906405.html