managed-schema中Valid attributes for fields的中文翻译
managed-schema文件的命名规则
字段名由字母数字下划线组成,且不能以数字开头。两端为下划线的字段为保留字段,如(version)。
<!-- Valid attributes for fields:
name: mandatory - the name for the field
type: mandatory - the name of a field type from the
fieldTypes section
indexed: true if this field should be indexed (searchable or sortable)
stored: true if this field should be retrievable
docValues: true if this field should have doc values. Doc Values is
recommended (required, if you are using *Point fields) for faceting,
grouping, sorting and function queries. Doc Values will make the index
faster to load, more NRT-friendly and more memory-efficient.
They are currently only supported by StrField, UUIDField, all
*PointFields, and depending on the field type, they might require
the field to be single-valued, be required or have a default value
(check the documentation of the field type you're interested in for
more information)
multiValued: true if this field may contain multiple values per document
omitNorms: (expert) set to true to omit the norms associated with
this field (this disables length normalization and index-time
boosting for the field, and saves some memory). Only full-text
fields or fields that need an index-time boost need norms.
Norms are omitted for primitive (non-analyzed) types by default.
termVectors: [false] set to true to store the term vector for a
given field.
When using MoreLikeThis, fields used for similarity should be
stored for best performance.
termPositions: Store position information with the term vector.
This will increase storage costs.
termOffsets: Store offset information with the term vector. This
will increase storage costs.
required: The field is required. It will throw an error if the
value does not exist
default: a value that should be used if no value is specified
when adding a document.
-->
翻译内容
<!-- 字段的有效属性:
name: 字段名 (必须属性)
type: <types>中定义的字段类型 (必须属性)
indexed: 如果字段需要被索引(用于搜索或排序),值设置为true
stored: 如果字段内容需要被返回,值设置为true;
如果返回的字段在文档(documents)里没数据,则不会返回,即没有对应数据的字段不会被返回。
docValues: 如果这个字段应该有文档值(doc values),设置为true。
文档值在门面搜索,分组,排序和函数查询中会非常有用。虽然不是必须的,而且会导致生成
索引变大变慢,但这样设置会使索引加载更快,NRT更加友好,内存使用效率更高。
然而也有一些使用限制:目前仅支持StrField, UUIDField和所有 Trie*Fields,
并且依赖字段类型, 可能要求字段为单值(single-valued)的,必须的或者有默认值。
multiValued: 如果这个字段在每个文档中可能包含多个值,设置为true
termVectors: [false] 设置为true后,会保存所给字段的相关向量(vector)
当使用MoreLikeThis时, 用于相似度判断的字段需要设置为stored来达到最佳性能.
termPositions: 保存和向量相关的位置信息,会增加存储开销
termOffsets: 保存 offset 和向量相关的信息,会增加存储开销
required: 字段必须有值,否则会抛异常
default: 在增加文档时,可以根据需要为字段设置一个默认值,防止为空
-->