solr schema.xml Field属性详解

时间:2021-08-07 17:18:02
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />

常用的公共属性有:
name:标识。

type:fieldType定义的类型。

indexed=true|false:是否被用来建立索引(关系到搜索和排序)

stored=true|false:是否储存

compressed=true|false,是否使用gzip压缩(只有TextField和StrField可以压缩)

compressThreshold=压缩阀值

multiValued=true|false 是否包含多个值,即一个名字可以被多个document所用。

omitNorms=true|false这是个高级选项。设置为true,省略与这一field相关的规范(这将禁用长度规范化和索引时间权重( index-time boosting for the field),并节省一些内存)。仅仅用在全文本field。

omitNorms在建立索引时会存储相关的影响boost打分的长度因子,因此对于不需要打分排序考虑的,omitNorm设置成true

termVectors=false|true 如果设置为true,则包含了所有的term vector 信息。通常用的属性有:
termPositions=”true”:存储 term vector中的地址信息,会消耗存储开销。
termOffsets:存储 term vector 的偏移量,会消耗存储开销。
更多有关信息请参考:http://wiki.apache.org/solr/TermVectorComponent

omitTermFreqAndPositions=true|false 如果设置,省略掉freq和term vector中的地址信息

omitPositions=true|false如果设置,省略掉term vector中的地址信息

default:如果没有属性需要修改,就可以用这个标识下。
英文原文:

Common options that fields can have are...
 
default
The default value for this field if none is provided while adding documents   indexed=true|false True if this field should be "indexed". If (and only if) a field is indexed, then it is searchable, sortable, and facetable.   stored=true|false True if the value of the field should be retrievable during a search, or if you're using highlighting or MoreLikeThis.   compressed=true|false True if this field should be stored using gzip compression. (This will only apply if the field type is compressible; among the standard field types, only TextField and StrField are.)   compressThreshold=<integer>   multiValued=true|false True if this field may contain multiple values per document, i.e. if it can appear multiple times in a document   omitNorms=true|false This is arguably an advanced option. 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.   termVectors=false|true <?> Solr 1.1 If set, include full term vector info. If enabled, often also used with termPositions="true" and termOffsets="true". To use interactively, requires TermVectorComponent Corresponds to TV button in Luke, and V field attribute.   omitTermFreqAndPositions=true|false <!> Solr1.4 If set, omit term freq, positions and payloads from postings for this field. This can be a performance boost for fields that don't require that information and reduces storage space required for the index. Queries that rely on position that are issued on a field with this option fail with an exception. Prior to <!> Solr4.0 the queries would silently fail to find documents.   omitPositions=true|false <!> Solr3.4 If set, omits positions, but keeps term frequencies