Schema.xmlThe fundamental purpose of this configuration file is to tell SOLR how to build the index through configuration.
the data structure of SOLR is as follows:
- Document: A file, a record
SOLR returns a number of eligible document by searching for some or some field, or by searching for the score sort. When compared to a database, document is equivalent to a table in a database, and field is the equivalent of a table. The schema.xml is to define the structure of a table (defining the names, types, constraints, and so on) of each field.
the basic structure of Schema.xml is as follows:<schema> <types> <fields> <uniqueKey> <copyField></schema>
Common Configuration instructions:
- Field: Defines the fields in a document
- name: Required. The name of the field. Names that are underlined before and after are the name of the system reservation, such as "_version_"
- type: Required. Type, corresponding to the name of the FieldType
- Default: The field defaults
- indexed: True/false, whether to index the field so that the user can search for it and count it (facet)
- stored: true/false, defines whether this field can be returned to the queried person
- multivalued: true/false, whether multiple values can be accommodated (such as multiple Copyfield dest point to it). If true, the field cannot be sorted and cannot be used as a uniquekey
- Required: True/false, Tell SOLR if this field accepts null values, the default is False
- docvalues: true/false, establishing Document-to-value Index to improve the efficiency of some special searches (sorting, statistics, highlighting)
- Copyfield: Copy the contents of one field to another field. Typically used to copy several different field to the same field to facilitate a search of only one field
- Source: The field being copied, supports specifying multiple fields with wildcards, such as: *_name
- dest: Copy to the destination field
- maxchars: Maximum number of characters
- uniquekey: Specify a field as a unique index
- FieldType: Defines the type of field, including some of the following properties
- name: Required, used by field configuration
- Class : Required, Filedtype implementation class. Solr. TextField is the path abbreviation, "equivalent to " Org.apache.solr.schema.TextField "
- Multivalued:?
- positionincrementgap: Specify the distance of the mutivalued
- Ananlyzer : If class is SOLR. TextField, this configuration is required. Tell Solr how to deal with certain words, how to participle, such as to remove the "a", not all lowercase ...
- type : index or query
- tokenizer : Word breaker, for example: Standardtokenizerfactory
- filter : Filter, For example: Lowercasefilterfactory
- DynamicField: Use wildcard characters to define a field to exist without being defined by field
- name: Use wildcard characters, such as "*_i", to handle field like "Cost_i"
Schema information can be obtained via HTTP API: Http://<ip>:8983/solr/<collection>/schema?wt=json
Http://<ip>:8983/solr/<collection>/schema/fields?wt=jsonhttp://<ip>:8983/solr/<collection >/schema/dynamicfields?wt=json
Http://<ip>:8983/solr/<collection>/schema/copyfields?wt=json
(original article, reprint please specify the blog from Clement-xu)
Copyright NOTICE: This article is the original article, reprint please indicate the CSDN blog which is transferred from Clement-xu.
Schema.xml of SOLR configuration files