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>
fieldType 标签的属性说明
<fieldType name="date" class="solr.DatePointField" sortMissingLast="true" omitNorms="true"/>
主要分为:
* 通用属性
* 字段默认属性
可以在字段类型上指定,也可在单个字段上指定
举例:
indexed 是否已加入倒排索引,如果为false,则此字段搜索不到符合条件的文档
stored 意味着是否在结果中展示(也可通过 fl 控制是否在结果中显示)
参考
https://solr.apache.org/guide/8_8/overview-of-documents-fields-and-schema-design.html