Solr configuration-Schema. xml

Source: Internet
Author: User
Tags solr

Refer to the configuration: http://wiki.apache.org/solr/SchemaXml (basically the document above has been very detailed)

Let's take a look at the configuration of Schema. xml.

1, uniqueKey

2. fieldType with different n names

3. Various fields: field, dynamicField, and copyField

4. Default commented out defasearchsearchfield, solrQueryParser, Similarity

Let's take a look at what it means:

1. uniqueKey: the unique identifier and unique key of the document. Here, the field that appears below is generally called id, which will be used during update and deletion.

<UniqueKey> id </uniqueKey>

2. fieldType: it is a common reusable definition that defines how Solr handles the Field. That is, the type of the xml file attribute added to the index, such as int, text, and date.

Attribute description:

Name # identifier, corresponding to Field type class # corresponds to the type ClasssortMissingLast defined by solr # after the data without this field is set to true, the default value is false regardless of the request sorting rules. SortMissingFirst # Conversely, the default is falseanalyzer # The token specified by the field type
Tokenizer # token class
Type # The operation used for the current word segmentation. index indicates the word segmentation used when the index is generated. The query code uses the filter when querying # The filter used after word segmentation. The call sequence is the same as the configuration.

3. Fields defines the Fields to be displayed in the search results, that is, they are used in doucument for search or only display.

Field: common field settings

<Field name = "sn" type = "string" indexed = "true" stored = "true"/>

 

DynamicField: Dynamic field settings, used for subsequent custom fields. * wildcard. For example, test_ I is a dynamic field of the int type.

<DynamicField name = "* _ I" type = "integer" indexed = "true" stored = "true"/>

 

CopyField: the field used for retrieval. In this way, only this field is indexed and segmented. If the dest field of copyField has multiple sources, you must set multiValued = true, otherwise, an error is reported.

<CopyField source = "body" dest = "teaser" maxChars = "300"/>

 

Fields attribute description:

Name # Field type name class # java class name indexed # The default value is true. Whether the data is indexed indicates that the data should be searched and sorted, which is generally opposite to stored. Stored # The default value is true. Whether the field is stored indicates that the field is included in the search result, which is generally different from indexed. The length of the omitNorms # field does not affect the score and is set to true if no boost is performed during indexing. Generally, the text field is not set to true. TermVectors # set it to true if the field is used for more like this and highlight features. Compressed # The field is compressed. This may lead to slow indexing and search, but will reduce storage space. Only StrField and TextField can be compressed, which is generally suitable for a field with a length of more than 200 characters. MultiValued # whether there are multiple values. PositionIncrementGap # used with multiValued to set the number of white spaces between multiple values

 

4. Defasearchsearchfield: Default search attribute. For example, q = text is the default search text field.

 

<Defasearchsearchfield> text </defasearchsearchfield>

SolrQueryParser: query conversion mode, whether OR (AND/OR must be capitalized)

<SolrQueryParser defaultOperator = "OR"/>

Similarity: a user-defined scorecard. class is a class that inherits the simsimilarity class or implements the scorecard interface,

The following parameter str should be a parameter with the configurable name paramkey and the value of param value.

<Similarity class = "com. example. solr. CustomSimilarityFactory"> <str name = "paramkey"> param value </str> </similarity>

 

Solr configuration-Schema. xml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.