1 <?xml version="1.0" encoding="UTF-8" ?>
3 Licensed to the Apache Software Foundation (ASF) under one or more
4 contributor license agreements. See the NOTICE file distributed with
5 this work for additional information regarding copyright ownership.
6 The ASF licenses this file to You under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with
8 the License. You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
20 This is the Solr schema file. This file should be named "schema.xml" and
21 should be in the conf directory under the solr home
22 (i.e. ./solr/conf/schema.xml by default)
23 or located where the classloader for the Solr webapp can find it.
25 This example schema is the recommended starting point for users.
26 It should be kept correct and concise, usable out-of-the-box.
28 For more information, on how to customize this file, please see
29 http://wiki.apache.org/solr/SchemaXml
31 PERFORMANCE NOTE: this schema includes many optional features and should not
32 be used for benchmarking. To improve performance one could
33 - set stored="false" for all fields possible (esp large fields) when you
34 only need to search on the field but don't need to return the original
36 - set indexed="false" if you don't need to search on the field, but only
37 return the field as a result of searching on other indexed fields.
38 - remove all unneeded copyField statements
39 - for best index size and searching performance, set "index" to false
40 for all general text fields, use copyField to copy them to the
41 catchall "text" field, and use that for searching.
42 - For maximum indexing performance, use the StreamingUpdateSolrServer
44 - Remember to run the JVM in server mode, and use a higher logging level
45 that avoids logging every request
48 <schema name="example" version="1.5">
49 <!-- attribute "name" is the name of this schema and is only used for display purposes.
50 version="x.y" is Solr's version number for the schema syntax and semantics. It should
51 not normally be changed by applications.
52 1.0: multiValued attribute did not exist, all fields are multiValued by nature
53 1.1: multiValued attribute introduced, false by default
54 1.2: omitTermFreqAndPositions attribute introduced, true by default except for text fields.
55 1.3: removed optional field compress feature
56 1.4: default auto-phrase (QueryParser feature) to off
57 1.5: omitNorms defaults to true for primitive field types (int, float, boolean, string...)
61 <!-- Valid attributes for fields:
62 name: mandatory - the name for the field
63 type: mandatory - the name of a field type from the
64 <types> fieldType section
65 indexed: true if this field should be indexed (searchable or sortable)
66 stored: true if this field should be retrievable
67 multiValued: true if this field may contain multiple values per document
68 omitNorms: (expert) set to true to omit the norms associated with
69 this field (this disables length normalization and index-time
70 boosting for the field, and saves some memory). Only full-text
71 fields or fields that need an index-time boost need norms.
72 Norms are omitted for primitive (non-analyzed) types by default.
73 termVectors: [false] set to true to store the term vector for a
75 When using MoreLikeThis, fields used for similarity should be
76 stored for best performance.
77 termPositions: Store position information with the term vector.
78 This will increase storage costs.
79 termOffsets: Store offset information with the term vector. This
80 will increase storage costs.
81 required: The field is required. It will throw an error if the
83 default: a value that should be used if no value is specified
84 when adding a document.
87 <!-- field names should consist of alphanumeric or underscore characters only and
88 not start with a digit. This is not currently strictly enforced,
89 but other field names will not have first class support from all components
90 and back compatibility is not guaranteed. Names with both leading and
91 trailing underscores (e.g. _version_) are reserved.
94 <field name="book_id" type="int" indexed="true" stored="true" />
95 <field name="parent_id" type="int" indexed="false" stored="true" />
96 <field name="slug" type="lowercase" stored="false" indexed="true" omitNorms="true"/> <!-- no norms -->
97 <field name="is_book" type="boolean" stored="false" indexed="true"/>
98 <field name="authors" type="text_pl_nonstop" stored="false" indexed="true" multiValued="true" termPositions="true" termVectors="true"/>
99 <field name="translators" type="text_pl_nonstop" stored="false" indexed="true" multiValued="true" termPositions="true" termVectors="true" />
100 <field name="title" type="text_pl_nonstop" stored="false" indexed="true"/>
101 <!-- <field name="published_date" type="tdate" stored="false" indexed="true"/>-->
102 <field name="published_date" type="string" stored="true" indexed="true"/>
104 <field name="epochs" type="lowercase" stored="false" indexed="false" multiValued="true" />
105 <field name="kinds" type="lowercase" stored="false" indexed="false" multiValued="true" />
106 <field name="genres" type="lowercase" stored="false" indexed="false" multiValued="true" />
108 <field name="metadata" type="text_pl_nonstop" stored="false" indexed="true" multiValued="true" termPositions="true" termVectors="true" />
110 <field name="themes" type="lowercase" stored="true" indexed="true" termVectors="true" termPositions="true" multiValued="true" />
111 <field name="themes_pl" type="text_pl_nonstop" stored="true" indexed="true" termVectors="true" termPositions="true" multiValued="true" />
112 <field name="header_index" type="int" stored="true" indexed="true"/>
113 <field name="header_span" type="int" stored="true" indexed="true"/>
114 <field name="header_type" type="lowercase" stored="true" indexed="false"/>
115 <field name="text" type="text_pl" stored="false" indexed="true" termVectors="true" termPositions="true" />
117 <field name="snippets_position" type="int" stored="true" indexed="false"/>
118 <field name="snippets_length" type="int" stored="true" indexed="false"/>
119 <field name="snippets_revision" type="int" stored="true" indexed="false"/>
120 <field name="fragment_anchor" type="string" stored="true" indexed="false"/>
122 <field name="picture_id" type="int" indexed="true" stored="true" />
123 <field name="area_id" type="int" stored="true" indexed="false"/>
125 <field name="tag_id" type="int" stored="true" indexed="true"/>
126 <field name="tag_name" type="lowercase" stored="true" indexed="true" />
127 <field name="tag_name_pl" type="text_pl_nonstop" stored="false" indexed="true" multiValued="true"/>
128 <field name="tag_category" type="string" stored="true" indexed="true" />
129 <field name="is_pdcounter" type="boolean" stored="true" indexed="true" />
131 <field name="_version_" type="long" indexed="true" stored="true"/>
133 <!-- Uncommenting the following will create a "timestamp" field using
134 a default value of "NOW" to indicate when each document was indexed.
137 <field name="timestamp" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/>
140 <!-- uncomment the following to ignore any fields that don't already match an existing
141 field name or dynamic field, rather than reporting them as an error.
142 alternately, change the type="ignored" to some other type e.g. "text" if you want
143 unknown fields indexed and/or stored by default -->
144 <!--dynamicField name="*" type="ignored" multiValued="true" /-->
145 <field name="uid" type="string" indexed="true" stored="true"/>
149 <!-- Field to use to determine and enforce document uniqueness.
150 Unless this field is marked with required="false", it will be a required field
152 <uniqueKey>uid</uniqueKey>
154 <!-- copyField commands copy one field to another at the time a document
155 is added to the index. It's used either to index the same field differently,
156 or to add multiple fields to the same field for easier/faster searching. -->
158 <copyField source="themes" dest="themes_pl"/>
159 <copyField source="tag_name" dest="tag_name_pl"/>
161 <copyField source="translators" dest="metadata"/>
162 <copyField source="epochs" dest="metadata"/>
163 <copyField source="kinds" dest="metadata"/>
164 <copyField source="genres" dest="metadata"/>
167 <!-- field type definitions. The "name" attribute is
168 just a label to be used by field definitions. The "class"
169 attribute and any other attributes determine the real
170 behavior of the fieldType.
171 Class names starting with "solr" refer to java classes in a
172 standard package such as org.apache.solr.analysis
175 <!-- The StrField type is not analyzed, but indexed/stored verbatim. -->
176 <fieldType name="string" class="solr.StrField" sortMissingLast="true" />
178 <!-- boolean type: "true" or "false" -->
179 <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
181 <!-- sortMissingLast and sortMissingFirst attributes are optional attributes are
182 currently supported on types that are sorted internally as strings
183 and on numeric types.
184 This includes "string","boolean", and, as of 3.5 (and 4.x),
185 int, float, long, date, double, including the "Trie" variants.
186 - If sortMissingLast="true", then a sort on this field will cause documents
187 without the field to come after documents with the field,
188 regardless of the requested sort order (asc or desc).
189 - If sortMissingFirst="true", then a sort on this field will cause documents
190 without the field to come before documents with the field,
191 regardless of the requested sort order.
192 - If sortMissingLast="false" and sortMissingFirst="false" (the default),
193 then default lucene sorting will be used which places docs without the
194 field first in an ascending sort and last in a descending sort.
198 Default numeric field types. For faster range queries, consider the tint/tfloat/tlong/tdouble types.
200 <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
201 <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
202 <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
203 <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
206 Numeric field types that index each value at various levels of precision
207 to accelerate range queries when the number of values between the range
208 endpoints is large. See the javadoc for NumericRangeQuery for internal
209 implementation details.
211 Smaller precisionStep values (specified in bits) will lead to more tokens
212 indexed per value, slightly larger index size, and faster range queries.
213 A precisionStep of 0 disables indexing at different precision levels.
215 <fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>
216 <fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/>
217 <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/>
218 <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/>
220 <!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
221 is a more restricted form of the canonical representation of dateTime
222 http://www.w3.org/TR/xmlschema-2/#dateTime
223 The trailing "Z" designates UTC time and is mandatory.
224 Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
225 All other components are mandatory.
227 Expressions can also be used to denote calculations that should be
228 performed relative to "NOW" to determine the value, ie...
231 ... Round to the start of the current hour
233 ... Exactly 1 day prior to now
234 NOW/DAY+6MONTHS+3DAYS
235 ... 6 months and 3 days in the future from the start of
238 Consult the DateField javadocs for more information.
240 Note: For faster range queries, consider the tdate type
242 <fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>
244 <!-- A Trie based date field for faster date range queries and date faceting. -->
245 <fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" positionIncrementGap="0"/>
248 <!--Binary data type. The data should be sent/retrieved in as Base64 encoded Strings -->
249 <fieldtype name="binary" class="solr.BinaryField"/>
251 <!-- The "RandomSortField" is not used to store or search any
252 data. You can declare fields of this type it in your schema
253 to generate pseudo-random orderings of your docs for sorting
254 or function purposes. The ordering is generated based on the field
255 name and the version of the index. As long as the index version
256 remains unchanged, and the same field name is reused,
257 the ordering of the docs will be consistent.
258 If you want different psuedo-random orderings of documents,
259 for the same version of the index, use a dynamicField and
260 change the field name in the request.
262 <fieldType name="random" class="solr.RandomSortField" indexed="true" />
264 <fieldType name="uuid" class="solr.UUIDField" indexed="true" />
267 <!-- A text field that only splits on whitespace for exact matching of words -->
268 <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
270 <tokenizer class="solr.WhitespaceTokenizerFactory"/>
274 <!-- charFilter + WhitespaceTokenizer -->
276 <fieldType name="text_char_norm" class="solr.TextField" positionIncrementGap="100" >
278 <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
279 <tokenizer class="solr.WhitespaceTokenizerFactory"/>
284 <!-- lowercases the entire field value, keeping it as a single token. -->
285 <fieldType name="lowercase" class="solr.TextField" positionIncrementGap="100">
287 <tokenizer class="solr.KeywordTokenizerFactory"/>
288 <filter class="solr.LowerCaseFilterFactory" />
292 <!-- since fields of this type are by default not stored or indexed,
293 any data added to them will be ignored outright. -->
294 <fieldtype name="ignored" stored="false" indexed="false" multiValued="true" class="solr.StrField" />
297 <fieldType name="text_pl" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
298 <analyzer type="index">
299 <tokenizer class="solr.StandardTokenizerFactory"/>
300 <filter class="solr.LowerCaseFilterFactory"/>
301 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_pl.txt" format="snowball"/>
302 <filter class="solr.MorfologikFilterFactory" dictionary="morfologik/stemming/polish/polish.dict" />
303 <filter class="solr.ASCIIFoldingFilterFactory" preserveOriginal="true" />
305 <analyzer type="query">
306 <tokenizer class="solr.StandardTokenizerFactory"/>
307 <filter class="solr.LowerCaseFilterFactory"/>
308 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_pl.txt" format="snowball"/>
309 <filter class="solr.MorfologikFilterFactory" dictionary="morfologik/stemming/polish/polish.dict" />
313 <fieldType name="text_pl_nonstop" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
314 <analyzer type="index">
315 <tokenizer class="solr.StandardTokenizerFactory"/>
316 <filter class="solr.LowerCaseFilterFactory"/>
317 <filter class="solr.MorfologikFilterFactory" dictionary="morfologik/stemming/polish/polish.dict" />
318 <filter class="solr.ASCIIFoldingFilterFactory" preserveOriginal="true" />
320 <analyzer type="query">
321 <tokenizer class="solr.StandardTokenizerFactory"/>
322 <filter class="solr.LowerCaseFilterFactory"/>
323 <filter class="solr.MorfologikFilterFactory" dictionary="morfologik/stemming/polish/polish.dict" />
329 <!-- Similarity is the scoring routine for each document vs. a query.
330 A custom Similarity or SimilarityFactory may be specified here, but
331 the default is fine for most applications.
332 For more info: http://wiki.apache.org/solr/SchemaXml#Similarity
335 <similarity class="com.example.solr.CustomSimilarityFactory">
336 <str name="paramkey">param value</str>