InstallingFedoraGSearch: schema.xml

File schema.xml, 18.9 kB (added by chi, 3 months ago)
Line 
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
32 <schema name="example" version="1.1">
33   <!-- attribute "name" is the name of this schema and is only used for display purposes.
34        Applications should change this to reflect the nature of the search collection.
35        version="1.1" is Solr's version number for the schema syntax and semantics.  It should
36        not normally be changed by applications.
37        1.0: multiValued attribute did not exist, all fields are multiValued by nature
38        1.1: multiValued attribute introduced, false by default -->
39
40   <types>
41     <!-- field type definitions. The "name" attribute is
42        just a label to be used by field definitions.  The "class"
43        attribute and any other attributes determine the real
44        behavior of the fieldType.
45          Class names starting with "solr" refer to java classes in the
46        org.apache.solr.analysis package.
47     -->
48
49     <!-- The StrField type is not analyzed, but indexed/stored verbatim. 
50        - StrField and TextField support an optional compressThreshold which
51        limits compression (if enabled in the derived fields) to values which
52        exceed a certain si
53        e (in characters).
54     -->
55     <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
56
57     <!-- boolean type: "true" or "false" -->
58     <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
59
60     <!-- The optional sortMissingLast and sortMissingFirst attributes are
61          currently supported on types that are sorted internally as strings.
62        - If sortMissingLast="true", then a sort on this field will cause documents
63          without the field to come after documents with the field,
64          regardless of the requested sort order (asc or desc).
65        - If sortMissingFirst="true", then a sort on this field will cause documents
66          without the field to come before documents with the field,
67          regardless of the requested sort order.
68        - If sortMissingLast="false" and sortMissingFirst="false" (the default),
69          then default lucene sorting will be used which places docs without the
70          field first in an ascending sort and last in a descending sort.
71     -->   
72
73
74     <!-- numeric field types that store and index the text
75          value verbatim (and hence don't support range queries, since the
76          lexicographic ordering isn't equal to the numeric ordering) -->
77     <fieldType name="integer" class="solr.IntField" omitNorms="true"/>
78     <fieldType name="long" class="solr.LongField" omitNorms="true"/>
79     <fieldType name="float" class="solr.FloatField" omitNorms="true"/>
80     <fieldType name="double" class="solr.DoubleField" omitNorms="true"/>
81
82
83     <!-- Numeric field types that manipulate the value into
84          a string value that isn't human-readable in its internal form,
85          but with a lexicographic ordering the same as the numeric ordering,
86          so that range queries work correctly. -->
87     <fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
88     <fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/>
89     <fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/>
90     <fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/>
91
92
93     <!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
94          is a more restricted form of the canonical representation of dateTime
95          http://www.w3.org/TR/xmlschema-2/#dateTime   
96          The trailing "Z" designates UTC time and is mandatory.
97          Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
98          All other components are mandatory.
99
100          Expressions can also be used to denote calculations that should be
101          performed relative to "NOW" to determine the value, ie...
102
103                NOW/HOUR
104                   ... Round to the start of the current hour
105                NOW-1DAY
106                   ... Exactly 1 day prior to now
107                NOW/DAY+6MONTHS+3DAYS
108                   ... 6 months and 3 days in the future from the start of
109                       the current day
110                      
111          Consult the DateField javadocs for more information.
112       -->
113     <fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/>
114
115     <!-- solr.TextField allows the specification of custom text analyzers
116          specified as a tokenizer and a list of token filters. Different
117          analyzers may be specified for indexing and querying.
118
119          The optional positionIncrementGap puts space between multiple fields of
120          this type on the same document, with the purpose of preventing false phrase
121          matching across fields.
122
123          For more info on customizing your analyzer chain, please see
124          http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
125      -->
126
127     <!-- One can also specify an existing Analyzer class that has a
128          default constructor via the class attribute on the analyzer element
129     <fieldType name="text_greek" class="solr.TextField">
130       <analyzer class="org.apache.lucene.analysis.el.GreekAnalyzer"/>
131     </fieldType>
132     -->
133
134     <!-- A text field that only splits on whitespace for exact matching of words -->
135     <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
136       <analyzer>
137         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
138       </analyzer>
139     </fieldType>
140
141     <!-- A text field that uses WordDelimiterFilter to enable splitting and matching of
142         words on case-change, alpha numeric boundaries, and non-alphanumeric chars,
143         so that a query of "wifi" or "wi fi" could match a document containing "Wi-Fi".
144         Synonyms and stopwords are customized by external files, and stemming is enabled.
145         Duplicate tokens at the same position (which may result from Stemmed Synonyms or
146         WordDelim parts) are removed.
147         -->
148     <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
149       <analyzer type="index">
150         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
151         <!-- in this example, we will only use synonyms at query time
152         <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
153         -->
154         <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
155         <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
156         <filter class="solr.LowerCaseFilterFactory"/>
157         <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
158         <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
159       </analyzer>
160       <analyzer type="query">
161         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
162         <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
163         <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
164         <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0"/>
165         <filter class="solr.LowerCaseFilterFactory"/>
166         <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
167         <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
168       </analyzer>
169     </fieldType>
170
171
172     <!-- Less flexible matching, but less false matches.  Probably not ideal for product names,
173          but may be good for SKUs.  Can insert dashes in the wrong place and still match. -->
174     <fieldType name="textTight" class="solr.TextField" positionIncrementGap="100" >
175       <analyzer>
176         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
177         <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
178         <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
179         <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
180         <filter class="solr.LowerCaseFilterFactory"/>
181         <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
182         <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
183       </analyzer>
184     </fieldType>
185
186     <!-- This is an example of using the KeywordTokenizer along
187          With various TokenFilterFactories to produce a sortable field
188          that does not include some properties of the source text
189       -->
190     <fieldType name="caseInsensitiveSort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
191       <analyzer>
192         <!-- KeywordTokenizer does no actual tokenizing, so the entire
193              input string is preserved as a single token
194           -->
195         <tokenizer class="solr.KeywordTokenizerFactory"/>
196         <!-- The LowerCase TokenFilter does what you expect, which can be
197              when you want your sorting to be case insensitive
198           -->
199         <filter class="solr.LowerCaseFilterFactory" />
200         <!-- The TrimFilter removes any leading or trailing whitespace -->
201         <filter class="solr.TrimFilterFactory" />
202       </analyzer>
203     </fieldType>
204
205     <!-- since fields of this type are by default not stored or indexed, any data added to
206          them will be ignored outright
207      -->
208     <fieldtype name="ignored" stored="false" indexed="false" class="solr.StrField" />
209
210  </types>
211
212
213  <fields>
214    <!-- Valid attributes for fields:
215      name: mandatory - the name for the field
216      type: mandatory - the name of a previously defined type from the <types> section
217      indexed: true if this field should be indexed (searchable or sortable)
218      stored: true if this field should be retrievable
219      compressed: [false] if this field should be stored using gzip compression
220        (this will only apply if the field type is compressable; among
221        the standard field types, only TextField and StrField are)
222      multiValued: true if this field may contain multiple values per document
223      omitNorms: (expert) set to true to omit the norms associated with
224        this field (this disables length normalization and index-time
225        boosting for the field, and saves some memory).  Only full-text
226        fields or fields that need an index-time boost need norms.
227    -->
228
229    <!-- Fedora specific fields -->
230    <field name="PID" type="string" indexed="true" stored="true"/>
231    <field name="fgs.state" type="string" indexed="true" stored="true"/>
232    <field name="fgs.label" type="text" indexed="true" stored="true"/>
233    <field name="fgs.ownerId" type="string" indexed="true" stored="true"/>
234    <field name="fgs.createdDate" type="date" indexed="true" stored="true"/>
235    <field name="fgs.lastModifiedDate" type="date" indexed="true" stored="true"/>
236    <field name="fgs.contentModel" type="string" indexed="true" stored="true"/>
237    <field name="fgs.type" type="string" indexed="true" stored="true" multiValued="true"/>
238
239    <!-- DC Fields -->
240    <field name="dc.contributor" type="text" indexed="true" stored="true" multiValued="true"/>
241    <field name="dc.coverage" type="text" indexed="true" stored="true" multiValued="true"/>
242    <field name="dc.creator" type="text" indexed="true" stored="true" multiValued="true"/>
243    <field name="dc.date" type="text" indexed="true" stored="true" multiValued="true"/>
244    <field name="dc.description" type="text" indexed="true" stored="true" multiValued="true"/>
245    <field name="dc.format" type="text" indexed="true" stored="true" multiValued="true"/>
246    <field name="dc.identifier" type="text" indexed="true" stored="true" multiValued="true"/>
247    <field name="dc.language" type="text" indexed="true" stored="true" multiValued="true"/>
248    <field name="dc.publisher" type="text" indexed="true" stored="true" multiValued="true"/>
249    <field name="dc.relation" type="text" indexed="true" stored="true" multiValued="true"/>
250    <field name="dc.rights" type="text" indexed="true" stored="true" multiValued="true"/>
251    <field name="dc.source" type="text" indexed="true" stored="true" multiValued="true"/>
252    <field name="dc.subject" type="text" indexed="true" stored="true" multiValued="true"/>
253    <field name="dc.title" type="text" indexed="true" stored="true" multiValued="true"/>
254    <field name="dc.type" type="text" indexed="true" stored="true" multiValued="true"/>
255
256    <field name="dc2.contributor" type="string" indexed="true" stored="true" multiValued="true"/>
257    <field name="dc2.coverage" type="string" indexed="true" stored="true" multiValued="true"/>
258    <field name="dc2.creator" type="string" indexed="true" stored="true" multiValued="true"/>
259    <field name="dc2.date" type="string" indexed="true" stored="true" multiValued="true"/>
260    <field name="dc2.description" type="string" indexed="true" stored="true" multiValued="true"/>
261    <field name="dc2.format" type="string" indexed="true" stored="true" multiValued="true"/>
262    <field name="dc2.identifier" type="string" indexed="true" stored="true" multiValued="true"/>
263    <field name="dc2.language" type="string" indexed="true" stored="true" multiValued="true"/>
264    <field name="dc2.publisher" type="string" indexed="true" stored="true" multiValued="true"/>
265    <field name="dc2.relation" type="string" indexed="true" stored="true" multiValued="true"/>
266    <field name="dc2.rights" type="string" indexed="true" stored="true" multiValued="true"/>
267    <field name="dc2.source" type="string" indexed="true" stored="true" multiValued="true"/>
268    <field name="dc2.subject" type="string" indexed="true" stored="true" multiValued="true"/>
269    <field name="dc2.title" type="string" indexed="true" stored="true" multiValued="true"/>
270    <field name="dc2.type" type="string" indexed="true" stored="true" multiValued="true"/>
271
272   <field name="dc3.creator" type="caseInsensitiveSort" indexed="true" stored="true" multiValued="true"/>
273   <field name="dc3.subject" type="caseInsensitiveSort" indexed="true" stored="true" multiValued="true"/>
274   <field name="dc3.title" type="caseInsensitiveSort" indexed="true" stored="true" multiValued="true"/>
275
276    <field name="timestamp" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/>
277    
278
279    <!-- Dynamic field definitions.  If a field name is not found, dynamicFields
280         will be used if the name matches any of the patterns.
281         RESTRICTION: the glob-like pattern in the name attribute must have
282         a "*" only at the start or the end.
283         EXAMPLE:  name="*_i" will match any field ending in _i (like myid_i, z_i)
284         Longer patterns will be matched first.  if equal size patterns
285         both match, the first appearing in the schema will be used.  -->
286    <dynamicField name="*_i"  type="sint"    indexed="true"  stored="true"/>
287    <dynamicField name="*_s"  type="string"  indexed="true"  stored="true"/>
288    <dynamicField name="*_l"  type="slong"   indexed="true"  stored="true"/>
289    <dynamicField name="*_t"  type="text"    indexed="true"  stored="true"/>
290    <dynamicField name="*_b"  type="boolean" indexed="true"  stored="true"/>
291    <dynamicField name="*_f"  type="sfloat"  indexed="true"  stored="true"/>
292    <dynamicField name="*_d"  type="sdouble" indexed="true"  stored="true"/>
293    <dynamicField name="*_dt" type="date"    indexed="true"  stored="true"/>
294    <dynamicField name="fgs.*" type="text" indexed="true" stored="true" multiValued="true"/>
295    <dynamicField name="dsm.*" type="text" indexed="true" stored="true" multiValued="true"/>
296    <dynamicField name="rdf.*" type="text" indexed="true" stored="true" multiValued="true"/>
297
298    <!-- uncomment the following to ignore any fields that don't already match an existing
299         field name or dynamic field, rather than reporting them as an error.
300         alternately, change the type="ignored" to some other type e.g. "text" if you want
301         unknown fields indexed and/or stored by default -->
302    <!--dynamicField name="*" type="ignored" /-->
303    
304  </fields>
305
306  <!-- Field to use to determine and enforce document uniqueness.
307       Unless this field is marked with required="false", it will be a required field
308    -->
309  <uniqueKey>PID</uniqueKey>
310
311  <!-- field for the QueryParser to use when an explicit fieldname is absent -->
312  <defaultSearchField>fgs.label</defaultSearchField>
313
314  <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
315  <solrQueryParser defaultOperator="OR"/>
316
317   <!-- copyField commands copy one field to another at the time a document
318         is added to the index.  It's used either to index the same field differently,
319         or to add multiple fields to the same field for easier/faster searching.  -->
320  <copyField source="dc.contributor" dest="dc2.contributor"/>
321  <copyField source="dc.coverage" dest="dc2.coverage"/>
322  <copyField source="dc.creator" dest="dc2.creator"/>
323  <copyField source="dc.date" dest="dc2.date"/>
324  <copyField source="dc.description" dest="dc2.description"/>
325  <copyField source="dc.format" dest="dc2.format"/>
326  <copyField source="dc.identifier" dest="dc2.identifier"/>
327  <copyField source="dc.language" dest="dc2.language"/>
328  <copyField source="dc.publisher" dest="dc2.publisher"/>
329  <copyField source="dc.relation" dest="dc2.relation"/>
330  <copyField source="dc.rights" dest="dc2.rights"/>
331  <copyField source="dc.source" dest="dc2.source"/>
332  <copyField source="dc.subject" dest="dc2.subject"/>
333  <copyField source="dc.title" dest="dc2.title"/>
334  <copyField source="dc.type" dest="dc2.type"/>
335  <copyField source="dc.subject" dest="dc3.subject"/>
336  <copyField source="dc.title" dest="dc3.title"/>
337  <copyField source="dc.creator" dest="dc3.creator"/>
338
339
340  <!-- Similarity is the scoring routine for each document vs. a query.
341       A custom similarity may be specified here, but the default is fine
342       for most applications.  -->
343  <!-- <similarity class="org.apache.lucene.search.DefaultSimilarity"/> -->
344
345 </schema>