1 | <?xml version="1.0" encoding="UTF-8" ?> |
---|
2 | <!-- |
---|
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 |
---|
9 | |
---|
10 | http://www.apache.org/licenses/LICENSE-2.0 |
---|
11 | |
---|
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. |
---|
17 | --> |
---|
18 | |
---|
19 | <!-- |
---|
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. |
---|
24 | |
---|
25 | This example schema is the recommended starting point for users. |
---|
26 | It should be kept correct and concise, usable out-of-the-box. |
---|
27 | |
---|
28 | For more information, on how to customize this file, please see |
---|
29 | http://wiki.apache.org/solr/SchemaXml |
---|
30 | |
---|
31 | NOTE: this schema includes many optional features and should not |
---|
32 | be used for benchmarking. |
---|
33 | --> |
---|
34 | |
---|
35 | <schema name="example" version="1.2"> |
---|
36 | <!-- attribute "name" is the name of this schema and is only used for display purposes. |
---|
37 | Applications should change this to reflect the nature of the search collection. |
---|
38 | version="1.2" is Solr's version number for the schema syntax and semantics. It should |
---|
39 | not normally be changed by applications. |
---|
40 | 1.0: multiValued attribute did not exist, all fields are multiValued by nature |
---|
41 | 1.1: multiValued attribute introduced, false by default |
---|
42 | 1.2: omitTf attribute introduced, true by default --> |
---|
43 | |
---|
44 | <types> |
---|
45 | <!-- field type definitions. The "name" attribute is |
---|
46 | just a label to be used by field definitions. The "class" |
---|
47 | attribute and any other attributes determine the real |
---|
48 | behavior of the fieldType. |
---|
49 | Class names starting with "solr" refer to java classes in the |
---|
50 | org.apache.solr.analysis package. |
---|
51 | --> |
---|
52 | |
---|
53 | <!-- The StrField type is not analyzed, but indexed/stored verbatim. |
---|
54 | - StrField and TextField support an optional compressThreshold which |
---|
55 | limits compression (if enabled in the derived fields) to values which |
---|
56 | exceed a certain size (in characters). |
---|
57 | --> |
---|
58 | <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/> |
---|
59 | |
---|
60 | <!-- boolean type: "true" or "false" --> |
---|
61 | <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/> |
---|
62 | |
---|
63 | <!-- The optional sortMissingLast and sortMissingFirst attributes are |
---|
64 | currently supported on types that are sorted internally as strings. |
---|
65 | - If sortMissingLast="true", then a sort on this field will cause documents |
---|
66 | without the field to come after documents with the field, |
---|
67 | regardless of the requested sort order (asc or desc). |
---|
68 | - If sortMissingFirst="true", then a sort on this field will cause documents |
---|
69 | without the field to come before documents with the field, |
---|
70 | regardless of the requested sort order. |
---|
71 | - If sortMissingLast="false" and sortMissingFirst="false" (the default), |
---|
72 | then default lucene sorting will be used which places docs without the |
---|
73 | field first in an ascending sort and last in a descending sort. |
---|
74 | --> |
---|
75 | |
---|
76 | |
---|
77 | <!-- numeric field types that store and index the text |
---|
78 | value verbatim (and hence don't support range queries, since the |
---|
79 | lexicographic ordering isn't equal to the numeric ordering) --> |
---|
80 | <fieldType name="integer" class="solr.IntField" omitNorms="true"/> |
---|
81 | <fieldType name="long" class="solr.LongField" omitNorms="true"/> |
---|
82 | <fieldType name="float" class="solr.FloatField" omitNorms="true"/> |
---|
83 | <fieldType name="double" class="solr.DoubleField" omitNorms="true"/> |
---|
84 | |
---|
85 | |
---|
86 | <!-- Numeric field types that manipulate the value into |
---|
87 | a string value that isn't human-readable in its internal form, |
---|
88 | but with a lexicographic ordering the same as the numeric ordering, |
---|
89 | so that range queries work correctly. --> |
---|
90 | <fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/> |
---|
91 | <fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/> |
---|
92 | <fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/> |
---|
93 | <fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/> |
---|
94 | |
---|
95 | |
---|
96 | <!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and |
---|
97 | is a more restricted form of the canonical representation of dateTime |
---|
98 | http://www.w3.org/TR/xmlschema-2/#dateTime |
---|
99 | The trailing "Z" designates UTC time and is mandatory. |
---|
100 | Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z |
---|
101 | All other components are mandatory. |
---|
102 | |
---|
103 | Expressions can also be used to denote calculations that should be |
---|
104 | performed relative to "NOW" to determine the value, ie... |
---|
105 | |
---|
106 | NOW/HOUR |
---|
107 | ... Round to the start of the current hour |
---|
108 | NOW-1DAY |
---|
109 | ... Exactly 1 day prior to now |
---|
110 | NOW/DAY+6MONTHS+3DAYS |
---|
111 | ... 6 months and 3 days in the future from the start of |
---|
112 | the current day |
---|
113 | |
---|
114 | Consult the DateField javadocs for more information. |
---|
115 | --> |
---|
116 | <fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/> |
---|
117 | |
---|
118 | <!-- |
---|
119 | Numeric field types that manipulate the value into trie encoded strings which are not |
---|
120 | human readable in the internal form. Range searches on such fields use the fast Trie Range Queries |
---|
121 | which are much faster than range searches on the SortableNumberField types. |
---|
122 | |
---|
123 | For the fast range search to work, trie fields must be indexed. Trie fields are <b>not</b> sortable |
---|
124 | in numerical order. Also, they cannot be used in function queries. If one needs sorting as well as |
---|
125 | fast range search, one should create a copy field specifically for sorting. Same workaround is |
---|
126 | suggested for using trie fields in function queries as well. |
---|
127 | |
---|
128 | For each number being added to this field, multiple terms are generated as per the algorithm described in |
---|
129 | org.apache.lucene.search.trie package description. The possible number of terms depend on the precisionStep |
---|
130 | attribute and increase dramatically with higher precision steps (factor 2**precisionStep). The default |
---|
131 | value of precisionStep is 8. |
---|
132 | |
---|
133 | Note that if you use a precisionStep of 32 for int/float and 64 for long/double, then multiple terms |
---|
134 | will not be generated, range search will be no faster than any other number field, |
---|
135 | but sorting will be possible. |
---|
136 | --> |
---|
137 | <fieldType name="tint" class="solr.TrieField" type="integer" omitNorms="true" positionIncrementGap="0" indexed="true" stored="false" /> |
---|
138 | <fieldType name="tfloat" class="solr.TrieField" type="float" omitNorms="true" positionIncrementGap="0" indexed="true" stored="false" /> |
---|
139 | <fieldType name="tlong" class="solr.TrieField" type="long" omitNorms="true" positionIncrementGap="0" indexed="true" stored="false" /> |
---|
140 | <fieldType name="tdouble" class="solr.TrieField" type="double" omitNorms="true" positionIncrementGap="0" indexed="true" stored="false" /> |
---|
141 | |
---|
142 | <fieldType name="tdouble4" class="solr.TrieField" type="double" precisionStep="4" omitNorms="true" positionIncrementGap="0" indexed="true" stored="false" /> |
---|
143 | |
---|
144 | <!-- |
---|
145 | This date field manipulates the value into a trie encoded strings for fast range searches. They follow the |
---|
146 | same format and semantics as the normal DateField and support the date math syntax except that they are |
---|
147 | not sortable and cannot be used in function queries. |
---|
148 | --> |
---|
149 | <fieldType name="tdate" class="solr.TrieField" type="date" omitNorms="true" positionIncrementGap="0" indexed="true" stored="false" /> |
---|
150 | |
---|
151 | |
---|
152 | <!-- The "RandomSortField" is not used to store or search any |
---|
153 | data. You can declare fields of this type it in your schema |
---|
154 | to generate psuedo-random orderings of your docs for sorting |
---|
155 | purposes. The ordering is generated based on the field name |
---|
156 | and the version of the index, As long as the index version |
---|
157 | remains unchanged, and the same field name is reused, |
---|
158 | the ordering of the docs will be consistent. |
---|
159 | If you want differend psuedo-random orderings of documents, |
---|
160 | for the same version of the index, use a dynamicField and |
---|
161 | change the name |
---|
162 | --> |
---|
163 | <fieldType name="random" class="solr.RandomSortField" indexed="true" /> |
---|
164 | |
---|
165 | <!-- solr.TextField allows the specification of custom text analyzers |
---|
166 | specified as a tokenizer and a list of token filters. Different |
---|
167 | analyzers may be specified for indexing and querying. |
---|
168 | |
---|
169 | The optional positionIncrementGap puts space between multiple fields of |
---|
170 | this type on the same document, with the purpose of preventing false phrase |
---|
171 | matching across fields. |
---|
172 | |
---|
173 | For more info on customizing your analyzer chain, please see |
---|
174 | http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters |
---|
175 | --> |
---|
176 | |
---|
177 | <!-- One can also specify an existing Analyzer class that has a |
---|
178 | default constructor via the class attribute on the analyzer element |
---|
179 | <fieldType name="text_greek" class="solr.TextField"> |
---|
180 | <analyzer class="org.apache.lucene.analysis.el.GreekAnalyzer"/> |
---|
181 | </fieldType> |
---|
182 | --> |
---|
183 | |
---|
184 | <!-- A text field that only splits on whitespace for exact matching of words --> |
---|
185 | <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100"> |
---|
186 | <analyzer> |
---|
187 | <tokenizer class="solr.WhitespaceTokenizerFactory"/> |
---|
188 | </analyzer> |
---|
189 | </fieldType> |
---|
190 | |
---|
191 | <!-- A text field that uses WordDelimiterFilter to enable splitting and matching of |
---|
192 | words on case-change, alpha numeric boundaries, and non-alphanumeric chars, |
---|
193 | so that a query of "wifi" or "wi fi" could match a document containing "Wi-Fi". |
---|
194 | Synonyms and stopwords are customized by external files, and stemming is enabled. |
---|
195 | Duplicate tokens at the same position (which may result from Stemmed Synonyms or |
---|
196 | WordDelim parts) are removed. |
---|
197 | --> |
---|
198 | <fieldType name="text" class="solr.TextField" positionIncrementGap="100"> |
---|
199 | <analyzer type="index"> |
---|
200 | <tokenizer class="solr.WhitespaceTokenizerFactory"/> |
---|
201 | <!-- in this example, we will only use synonyms at query time |
---|
202 | <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/> |
---|
203 | --> |
---|
204 | <!-- Case insensitive stop word removal. |
---|
205 | add enablePositionIncrements=true in both the index and query |
---|
206 | analyzers to leave a 'gap' for more accurate phrase queries. |
---|
207 | --> |
---|
208 | <filter class="solr.StopFilterFactory" |
---|
209 | ignoreCase="true" |
---|
210 | words="stopwords.txt" |
---|
211 | enablePositionIncrements="true" |
---|
212 | /> |
---|
213 | <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/> |
---|
214 | <filter class="solr.LowerCaseFilterFactory"/> |
---|
215 | <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/> |
---|
216 | <filter class="solr.PorterStemFilterFactory"/> |
---|
217 | <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> |
---|
218 | </analyzer> |
---|
219 | <analyzer type="query"> |
---|
220 | <tokenizer class="solr.WhitespaceTokenizerFactory"/> |
---|
221 | <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> |
---|
222 | <filter class="solr.StopFilterFactory" |
---|
223 | ignoreCase="true" |
---|
224 | words="stopwords.txt" |
---|
225 | enablePositionIncrements="true" |
---|
226 | /> |
---|
227 | <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/> |
---|
228 | <filter class="solr.LowerCaseFilterFactory"/> |
---|
229 | <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/> |
---|
230 | <filter class="solr.PorterStemFilterFactory"/> |
---|
231 | <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> |
---|
232 | </analyzer> |
---|
233 | </fieldType> |
---|
234 | |
---|
235 | |
---|
236 | <!-- Less flexible matching, but less false matches. Probably not ideal for product names, |
---|
237 | but may be good for SKUs. Can insert dashes in the wrong place and still match. --> |
---|
238 | <fieldType name="textTight" class="solr.TextField" positionIncrementGap="100" > |
---|
239 | <analyzer> |
---|
240 | <tokenizer class="solr.WhitespaceTokenizerFactory"/> |
---|
241 | <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/> |
---|
242 | <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/> |
---|
243 | <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/> |
---|
244 | <filter class="solr.LowerCaseFilterFactory"/> |
---|
245 | <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/> |
---|
246 | <filter class="solr.EnglishMinimalStemFilterFactory"/> |
---|
247 | <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> |
---|
248 | </analyzer> |
---|
249 | </fieldType> |
---|
250 | |
---|
251 | <!-- |
---|
252 | Setup simple analysis for spell checking |
---|
253 | --> |
---|
254 | <fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" > |
---|
255 | <analyzer> |
---|
256 | <tokenizer class="solr.StandardTokenizerFactory"/> |
---|
257 | <filter class="solr.LowerCaseFilterFactory"/> |
---|
258 | <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> |
---|
259 | </analyzer> |
---|
260 | </fieldType> |
---|
261 | |
---|
262 | <!-- charFilter + "CharStream aware" WhitespaceTokenizer --> |
---|
263 | <!-- |
---|
264 | <fieldType name="textCharNorm" class="solr.TextField" positionIncrementGap="100" > |
---|
265 | <analyzer> |
---|
266 | <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/> |
---|
267 | <tokenizer class="solr.CharStreamAwareWhitespaceTokenizerFactory"/> |
---|
268 | </analyzer> |
---|
269 | </fieldType> |
---|
270 | --> |
---|
271 | |
---|
272 | <!-- This is an example of using the KeywordTokenizer along |
---|
273 | With various TokenFilterFactories to produce a sortable field |
---|
274 | that does not include some properties of the source text |
---|
275 | --> |
---|
276 | <fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true"> |
---|
277 | <analyzer> |
---|
278 | <!-- KeywordTokenizer does no actual tokenizing, so the entire |
---|
279 | input string is preserved as a single token |
---|
280 | --> |
---|
281 | <tokenizer class="solr.KeywordTokenizerFactory"/> |
---|
282 | <!-- The LowerCase TokenFilter does what you expect, which can be |
---|
283 | when you want your sorting to be case insensitive |
---|
284 | --> |
---|
285 | <filter class="solr.LowerCaseFilterFactory" /> |
---|
286 | <!-- The TrimFilter removes any leading or trailing whitespace --> |
---|
287 | <filter class="solr.TrimFilterFactory" /> |
---|
288 | <!-- The PatternReplaceFilter gives you the flexibility to use |
---|
289 | Java Regular expression to replace any sequence of characters |
---|
290 | matching a pattern with an arbitrary replacement string, |
---|
291 | which may include back refrences to portions of the orriginal |
---|
292 | string matched by the pattern. |
---|
293 | |
---|
294 | See the Java Regular Expression documentation for more |
---|
295 | infomation on pattern and replacement string syntax. |
---|
296 | |
---|
297 | http://java.sun.com/j2se/1.6.0/docs/api/java/util/regex/package-summary.html |
---|
298 | --> |
---|
299 | <filter class="solr.PatternReplaceFilterFactory" |
---|
300 | pattern="([^a-z])" replacement="" replace="all" |
---|
301 | /> |
---|
302 | </analyzer> |
---|
303 | </fieldType> |
---|
304 | |
---|
305 | <fieldtype name="phonetic" stored="false" indexed="true" class="solr.TextField" > |
---|
306 | <analyzer> |
---|
307 | <tokenizer class="solr.StandardTokenizerFactory"/> |
---|
308 | <filter class="solr.DoubleMetaphoneFilterFactory" inject="false"/> |
---|
309 | </analyzer> |
---|
310 | </fieldtype> |
---|
311 | |
---|
312 | |
---|
313 | <!-- since fields of this type are by default not stored or indexed, any data added to |
---|
314 | them will be ignored outright |
---|
315 | --> |
---|
316 | <fieldtype name="ignored" stored="false" indexed="false" class="solr.StrField" /> |
---|
317 | |
---|
318 | </types> |
---|
319 | |
---|
320 | |
---|
321 | <fields> |
---|
322 | <!-- Valid attributes for fields: |
---|
323 | name: mandatory - the name for the field |
---|
324 | type: mandatory - the name of a previously defined type from the <types> section |
---|
325 | indexed: true if this field should be indexed (searchable or sortable) |
---|
326 | stored: true if this field should be retrievable |
---|
327 | compressed: [false] if this field should be stored using gzip compression |
---|
328 | (this will only apply if the field type is compressable; among |
---|
329 | the standard field types, only TextField and StrField are) |
---|
330 | multiValued: true if this field may contain multiple values per document |
---|
331 | omitNorms: (expert) set to true to omit the norms associated with |
---|
332 | this field (this disables length normalization and index-time |
---|
333 | boosting for the field, and saves some memory). Only full-text |
---|
334 | fields or fields that need an index-time boost need norms. |
---|
335 | termVectors: [false] set to true to store the term vector for a given field. |
---|
336 | When using MoreLikeThis, fields used for similarity should be stored for |
---|
337 | best performance. |
---|
338 | termPositions: Store position information with the term vector. This will increase storage costs. |
---|
339 | termOffsets: Store offset information with the term vector. This will increase storage costs. |
---|
340 | --> |
---|
341 | |
---|
342 | <field name="messageId" type="string" indexed="true" stored="true" required="true" omitNorms="true" /> |
---|
343 | <field name="subject" type="string" indexed="true" stored="true" omitNorms="true" /> |
---|
344 | <field name="from" type="string" indexed="true" stored="true" omitNorms="true"/> |
---|
345 | <field name="sentDate" type="date" indexed="true" stored="true"/> |
---|
346 | <field name="xMailer" type="string" indexed="true" stored="true" omitNorms="true"/> |
---|
347 | |
---|
348 | <field name="allTo" type="string" indexed="true" stored="true" omitNorms="true" multiValued="true"/> |
---|
349 | <field name="flags" type="string" indexed="true" stored="true" omitNorms="true" multiValued="true"/> |
---|
350 | <field name="content" type="text" indexed="true" stored="true" omitNorms="true" multiValued="true"/> |
---|
351 | <field name="attachment" type="text" indexed="true" stored="true" omitNorms="true" multiValued="true"/> |
---|
352 | <field name="attachmentNames" type="string" indexed="true" stored="true" omitNorms="true" multiValued="true"/> |
---|
353 | |
---|
354 | <field name="catchAllField" type="text" indexed="true" stored="true" omitNorms="true" multiValued="true"/> |
---|
355 | |
---|
356 | </fields> |
---|
357 | |
---|
358 | <copyField source="content" dest="catchAllField"/> |
---|
359 | <copyField source="attachmentNames" dest="catchAllField"/> |
---|
360 | <copyField source="attachment" dest="catchAllField"/> |
---|
361 | <copyField source="subject" dest="catchAllField"/> |
---|
362 | <copyField source="allTo" dest="catchAllField"/> |
---|
363 | |
---|
364 | <!-- The unique key, Note that some mail servers may not send the message-id or they may send duplicate ones --> |
---|
365 | <uniqueKey>messageId</uniqueKey> |
---|
366 | |
---|
367 | <!-- field for the QueryParser to use when an explicit fieldname is absent --> |
---|
368 | <defaultSearchField>catchAllField</defaultSearchField> |
---|
369 | |
---|
370 | <!-- SolrQueryParser configuration: defaultOperator="AND|OR" --> |
---|
371 | <solrQueryParser defaultOperator="OR"/> |
---|
372 | |
---|
373 | </schema> |
---|