1
|
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
3
|
<xsl:output omit-xml-declaration="yes" indent="yes"/>
|
4
|
|
5
|
<xsl:template match="/FIELDS">
|
6
|
|
7
|
<xsl:param name="textFieldType" select="string('text_common')"/>
|
8
|
<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'"/>
|
9
|
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
10
|
|
11
|
<!--
|
12
|
D-Net index schema template
|
13
|
|
14
|
CHANGELOG
|
15
|
|
16
|
0.1 : first release
|
17
|
0.2 : added preserveOriginal="1" for text field type in the index analyzer and catenateWords="1" for the query analyzer
|
18
|
0.3 : changed language for SnowballPorterFilterFactory to language="German2" (index/query) in the text field type
|
19
|
0.4 : added solr.ASCIIFoldingFilterFactory filter (index/query) in the text field type
|
20
|
0.5 : added long_keyword field type, to be used for objIdentifiers
|
21
|
0.6 : added field types for spellchecking
|
22
|
0.7 : added parameter for text field type
|
23
|
0.8 : added field _version_, needed by Solr 4.0.0 for the transaction log
|
24
|
0.9 : added type: text_en_splitting
|
25
|
0.91 : added type: ngramtext
|
26
|
0.92 : added schema optimizations, removing unnecessary stored fields
|
27
|
0.93 : added attribute preserveOriginal="1" to fieldtype ngramtext (query analysis) to improve matches
|
28
|
0.94 : updated and simplified ngramtext fieldtype
|
29
|
0.95 : update to solr 4.4, removed attribute "compress" from field definition, ngramfield doesn't support NGramFilterFactory anymore
|
30
|
0.96 : update to solr 4.9
|
31
|
-->
|
32
|
<schema name="dnet" version="0.96">
|
33
|
|
34
|
<types>
|
35
|
|
36
|
<!-- The StrField type is not analyzed, but indexed/stored verbatim.
|
37
|
It supports doc values but in that case the field needs to be
|
38
|
single-valued and either required or have a default value.
|
39
|
-->
|
40
|
<fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
|
41
|
|
42
|
<!-- boolean type: "true" or "false" -->
|
43
|
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
|
44
|
|
45
|
<!-- sortMissingLast and sortMissingFirst attributes are optional attributes are
|
46
|
currently supported on types that are sorted internally as strings
|
47
|
and on numeric types.
|
48
|
This includes "string","boolean", and, as of 3.5 (and 4.x),
|
49
|
int, float, long, date, double, including the "Trie" variants.
|
50
|
- If sortMissingLast="true", then a sort on this field will cause documents
|
51
|
without the field to come after documents with the field,
|
52
|
regardless of the requested sort order (asc or desc).
|
53
|
- If sortMissingFirst="true", then a sort on this field will cause documents
|
54
|
without the field to come before documents with the field,
|
55
|
regardless of the requested sort order.
|
56
|
- If sortMissingLast="false" and sortMissingFirst="false" (the default),
|
57
|
then default lucene sorting will be used which places docs without the
|
58
|
field first in an ascending sort and last in a descending sort.
|
59
|
-->
|
60
|
|
61
|
<!--
|
62
|
Default numeric field types. For faster range queries, consider the tint/tfloat/tlong/tdouble types.
|
63
|
|
64
|
These fields support doc values, but they require the field to be
|
65
|
single-valued and either be required or have a default value.
|
66
|
-->
|
67
|
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
|
68
|
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
|
69
|
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
|
70
|
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
|
71
|
|
72
|
<!--
|
73
|
Numeric field types that index each value at various levels of precision
|
74
|
to accelerate range queries when the number of values between the range
|
75
|
endpoints is large. See the javadoc for NumericRangeQuery for internal
|
76
|
implementation details.
|
77
|
|
78
|
Smaller precisionStep values (specified in bits) will lead to more tokens
|
79
|
indexed per value, slightly larger index size, and faster range queries.
|
80
|
A precisionStep of 0 disables indexing at different precision levels.
|
81
|
-->
|
82
|
<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>
|
83
|
<fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/>
|
84
|
<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/>
|
85
|
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/>
|
86
|
|
87
|
<!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
|
88
|
is a more restricted form of the canonical representation of dateTime
|
89
|
http://www.w3.org/TR/xmlschema-2/#dateTime
|
90
|
The trailing "Z" designates UTC time and is mandatory.
|
91
|
Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
|
92
|
All other components are mandatory.
|
93
|
|
94
|
Expressions can also be used to denote calculations that should be
|
95
|
performed relative to "NOW" to determine the value, ie...
|
96
|
|
97
|
NOW/HOUR
|
98
|
... Round to the start of the current hour
|
99
|
NOW-1DAY
|
100
|
... Exactly 1 day prior to now
|
101
|
NOW/DAY+6MONTHS+3DAYS
|
102
|
... 6 months and 3 days in the future from the start of
|
103
|
the current day
|
104
|
|
105
|
Consult the DateField javadocs for more information.
|
106
|
|
107
|
Note: For faster range queries, consider the tdate type
|
108
|
-->
|
109
|
<fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>
|
110
|
|
111
|
<!-- A Trie based date field for faster date range queries and date faceting. -->
|
112
|
<fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" positionIncrementGap="0"/>
|
113
|
|
114
|
<!--
|
115
|
Note:
|
116
|
These should only be used for compatibility with existing indexes (created with older Solr versions)
|
117
|
or if "sortMissingFirst" or "sortMissingLast" functionality is needed. Use Trie based fields instead.
|
118
|
|
119
|
Numeric field types that manipulate the value into
|
120
|
a string value that isn't human-readable in its internal form,
|
121
|
but with a lexicographic ordering the same as the numeric ordering,
|
122
|
so that range queries work correctly.
|
123
|
-->
|
124
|
<fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
|
125
|
<fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/>
|
126
|
<fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/>
|
127
|
<fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/>
|
128
|
|
129
|
<!-- A text field that uses WordDelimiterFilter to enable splitting and matching of
|
130
|
words on case-change, alpha numeric boundaries, and non-alphanumeric chars,
|
131
|
so that a query of "wifi" or "wi fi" could match a document containing "Wi-Fi".
|
132
|
Synonyms and stopwords are customized by external files, and stemming is enabled.
|
133
|
-->
|
134
|
<fieldType name="text_common" class="solr.TextField" positionIncrementGap="100">
|
135
|
<analyzer type="index">
|
136
|
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
137
|
<filter class="solr.StopFilterFactory" ignoreCase="true"
|
138
|
words="stopwords.txt" enablePositionIncrements="true"/>
|
139
|
<filter class="solr.WordDelimiterFilterFactory"
|
140
|
preserveOriginal="1" generateWordParts="1"
|
141
|
generateNumberParts="1" catenateWords="1"
|
142
|
catenateNumbers="1" catenateAll="0"/>
|
143
|
<filter class="solr.LowerCaseFilterFactory"/>
|
144
|
<filter class="solr.ASCIIFoldingFilterFactory"/>
|
145
|
</analyzer>
|
146
|
<analyzer type="query">
|
147
|
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
148
|
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
|
149
|
<filter class="solr.StopFilterFactory" ignoreCase="true"
|
150
|
words="stopwords.txt" enablePositionIncrements="true"/>
|
151
|
<filter class="solr.WordDelimiterFilterFactory"
|
152
|
preserveOriginal="1" generateWordParts="1"
|
153
|
generateNumberParts="1" catenateWords="0"
|
154
|
catenateNumbers="0" catenateAll="0"/>
|
155
|
<filter class="solr.LowerCaseFilterFactory"/>
|
156
|
<filter class="solr.ASCIIFoldingFilterFactory"/>
|
157
|
</analyzer>
|
158
|
</fieldType>
|
159
|
|
160
|
<!-- A text field with defaults appropriate for English, plus
|
161
|
aggressive word-splitting and autophrase features enabled.
|
162
|
This field is just like text_en, except it adds
|
163
|
WordDelimiterFilter to enable splitting and matching of
|
164
|
words on case-change, alpha numeric boundaries, and
|
165
|
non-alphanumeric chars. This means certain compound word
|
166
|
cases will work, for example query "wi fi" will match
|
167
|
document "WiFi" or "wi-fi".
|
168
|
-->
|
169
|
<fieldType name="text_en_splitting" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
|
170
|
<analyzer type="index">
|
171
|
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
172
|
<!-- in this example, we will only use synonyms at query time
|
173
|
<filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
|
174
|
-->
|
175
|
<!-- Case insensitive stop word removal.
|
176
|
-->
|
177
|
<filter class="solr.StopFilterFactory"
|
178
|
ignoreCase="true"
|
179
|
words="stopwords_en.txt"
|
180
|
/>
|
181
|
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
|
182
|
<filter class="solr.LowerCaseFilterFactory"/>
|
183
|
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
|
184
|
<filter class="solr.PorterStemFilterFactory"/>
|
185
|
</analyzer>
|
186
|
<analyzer type="query">
|
187
|
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
188
|
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
|
189
|
<filter class="solr.StopFilterFactory"
|
190
|
ignoreCase="true"
|
191
|
words="stopwords_en.txt"
|
192
|
/>
|
193
|
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
|
194
|
<filter class="solr.LowerCaseFilterFactory"/>
|
195
|
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
|
196
|
<filter class="solr.PorterStemFilterFactory"/>
|
197
|
</analyzer>
|
198
|
</fieldType>
|
199
|
|
200
|
<fieldType name="ngramtext" class="solr.TextField" omitNorms="true">
|
201
|
<analyzer type="index">
|
202
|
<tokenizer class="solr.KeywordTokenizerFactory"/>
|
203
|
<filter class="solr.LowerCaseFilterFactory"/>
|
204
|
<filter class="solr.NGramFilterFactory" minGramSize="3" maxGramSize="25"/>
|
205
|
<filter class="solr.TrimFilterFactory"/>
|
206
|
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
|
207
|
</analyzer>
|
208
|
<analyzer type="query">
|
209
|
<tokenizer class="solr.KeywordTokenizerFactory"/>
|
210
|
<filter class="solr.LowerCaseFilterFactory"/>
|
211
|
</analyzer>
|
212
|
</fieldType>
|
213
|
|
214
|
<fieldType name="text_EFG" class="solr.TextField" positionIncrementGap="100">
|
215
|
<analyzer type="index">
|
216
|
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
217
|
<filter class="solr.StopFilterFactory" ignoreCase="true"
|
218
|
words="stopwords.txt" enablePositionIncrements="true"/>
|
219
|
<filter class="solr.WordDelimiterFilterFactory"
|
220
|
preserveOriginal="1" generateWordParts="1"
|
221
|
generateNumberParts="1" catenateWords="1"
|
222
|
catenateNumbers="1" catenateAll="0"
|
223
|
splitOnCaseChange="1"/>
|
224
|
<filter class="solr.LowerCaseFilterFactory"/>
|
225
|
<filter class="solr.SnowballPorterFilterFactory" language="German2" protected="protwords.txt"/>
|
226
|
<filter class="solr.ASCIIFoldingFilterFactory"/>
|
227
|
</analyzer>
|
228
|
<analyzer type="query">
|
229
|
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
230
|
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
|
231
|
<filter class="solr.StopFilterFactory" ignoreCase="true"
|
232
|
words="stopwords.txt" enablePositionIncrements="true"/>
|
233
|
<filter class="solr.WordDelimiterFilterFactory"
|
234
|
generateWordParts="0" generateNumberParts="1"
|
235
|
catenateWords="1" catenateNumbers="0"
|
236
|
catenateAll="0" splitOnCaseChange="1"/>
|
237
|
<filter class="solr.LowerCaseFilterFactory"/>
|
238
|
<filter class="solr.SnowballPorterFilterFactory" language="German2" protected="protwords.txt"/>
|
239
|
<filter class="solr.ASCIIFoldingFilterFactory"/>
|
240
|
</analyzer>
|
241
|
</fieldType>
|
242
|
|
243
|
<!-- A general unstemmed text field that indexes tokens normally and also
|
244
|
reversed (via ReversedWildcardFilterFactory), to enable more efficient
|
245
|
leading wildcard queries. -->
|
246
|
<fieldType name="text_rev" class="solr.TextField" positionIncrementGap="100">
|
247
|
<analyzer type="index">
|
248
|
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
249
|
<filter class="solr.StopFilterFactory" ignoreCase="true"
|
250
|
words="stopwords.txt" enablePositionIncrements="true"/>
|
251
|
<filter class="solr.WordDelimiterFilterFactory"
|
252
|
generateWordParts="1" generateNumberParts="1"
|
253
|
catenateWords="1" catenateNumbers="1"
|
254
|
catenateAll="0" splitOnCaseChange="0"/>
|
255
|
<filter class="solr.LowerCaseFilterFactory"/>
|
256
|
<filter class="solr.ReversedWildcardFilterFactory"
|
257
|
withOriginal="true" maxPosAsterisk="3"
|
258
|
maxPosQuestion="2" maxFractionAsterisk="0.33"/>
|
259
|
</analyzer>
|
260
|
<analyzer type="query">
|
261
|
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
262
|
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
|
263
|
<filter class="solr.StopFilterFactory" ignoreCase="true"
|
264
|
words="stopwords.txt" enablePositionIncrements="true"
|
265
|
/>
|
266
|
<filter class="solr.WordDelimiterFilterFactory"
|
267
|
generateWordParts="1" generateNumberParts="1"
|
268
|
catenateWords="0" catenateNumbers="0"
|
269
|
catenateAll="0" splitOnCaseChange="0"/>
|
270
|
<filter class="solr.LowerCaseFilterFactory"/>
|
271
|
</analyzer>
|
272
|
</fieldType>
|
273
|
|
274
|
<fieldType name="spelltext" class="solr.TextField" positionIncrementGap="100">
|
275
|
<analyzer type="index">
|
276
|
<tokenizer class="solr.StandardTokenizerFactory"/>
|
277
|
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
|
278
|
<filter class="solr.StandardFilterFactory"/>
|
279
|
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
|
280
|
</analyzer>
|
281
|
<analyzer type="query">
|
282
|
<tokenizer class="solr.StandardTokenizerFactory"/>
|
283
|
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
|
284
|
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
|
285
|
<filter class="solr.StandardFilterFactory"/>
|
286
|
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
|
287
|
</analyzer>
|
288
|
</fieldType>
|
289
|
|
290
|
<!-- used for objIdentifiers -->
|
291
|
<fieldType name="long_keyword" class="solr.TextField">
|
292
|
<analyzer>
|
293
|
<tokenizer class="solr.KeywordTokenizerFactory"/>
|
294
|
</analyzer>
|
295
|
</fieldType>
|
296
|
|
297
|
</types>
|
298
|
|
299
|
<fields>
|
300
|
|
301
|
<xsl:for-each select="./FIELD">
|
302
|
<xsl:variable name="fieldname" select="translate(@name, $uppercase, $smallcase)"/>
|
303
|
<xsl:variable name="fieldtype">
|
304
|
<xsl:choose>
|
305
|
<xsl:when test="@type='int'">sint</xsl:when>
|
306
|
<xsl:when test="@type='date'">date</xsl:when>
|
307
|
<xsl:when test="@type='ngramtext'">ngramtext</xsl:when>
|
308
|
<xsl:when test="@type='long_keyword'">long_keyword</xsl:when>
|
309
|
<xsl:when test="@tokenizable='false'">string</xsl:when>
|
310
|
<xsl:otherwise>
|
311
|
<xsl:value-of select="$textFieldType"/>
|
312
|
</xsl:otherwise>
|
313
|
</xsl:choose>
|
314
|
</xsl:variable>
|
315
|
<xsl:variable name="isMultivalued">
|
316
|
<xsl:choose>
|
317
|
<xsl:when test="@multivalued='false'">false</xsl:when>
|
318
|
<xsl:otherwise>true</xsl:otherwise>
|
319
|
</xsl:choose>
|
320
|
</xsl:variable>
|
321
|
<xsl:variable name="isStored">
|
322
|
<xsl:choose>
|
323
|
<xsl:when test="@stored='true'">true</xsl:when>
|
324
|
<xsl:otherwise>false</xsl:otherwise>
|
325
|
</xsl:choose>
|
326
|
</xsl:variable>
|
327
|
|
328
|
<field name="{$fieldname}" type="{$fieldtype}" indexed="{@indexable}" stored="{normalize-space($isStored)}" multiValued="{normalize-space($isMultivalued)}"/>
|
329
|
</xsl:for-each>
|
330
|
|
331
|
<field name="__indexrecordidentifier" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
|
332
|
|
333
|
<field name="__deleted" type="boolean" indexed="true" stored="false" default="false" omitNorms="true" omitTermFreqAndPositions="true"/>
|
334
|
|
335
|
<field name="__dsid" type="string" indexed="true" stored="true" omitNorms="true" omitTermFreqAndPositions="true"/>
|
336
|
|
337
|
<field name="__dsversion" type="tdate" indexed="true" stored="true" omitNorms="true" omitTermFreqAndPositions="true"/>
|
338
|
|
339
|
<field name="__result" type="{$textFieldType}" indexed="false" stored="true"/>
|
340
|
|
341
|
<field name="__fulltext" type="{$textFieldType}" indexed="false" stored="true" default=""/>
|
342
|
|
343
|
<field name="__all" type="{$textFieldType}" indexed="true" stored="false" multiValued="true"/>
|
344
|
|
345
|
<field name="__spell" type="spelltext" indexed="true" stored="false" omitNorms="true" omitTermFreqAndPositions="true"/>
|
346
|
|
347
|
<field name="cql.serverchoice" type="{$textFieldType}" indexed="true" stored="false" multiValued="true" omitNorms="true" omitTermFreqAndPositions="true"/>
|
348
|
|
349
|
<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
|
350
|
|
351
|
<!-- catchall text field that indexes tokens both normally and in reverse for efficient
|
352
|
leading wildcard queries. -->
|
353
|
<field name="text_rev" type="text_rev" indexed="true" stored="false" multiValued="true"/>
|
354
|
|
355
|
<!-- field for ping -->
|
356
|
<field name="text" type="text_common" indexed="false" stored="false"/>
|
357
|
|
358
|
|
359
|
</fields>
|
360
|
|
361
|
<!-- Field to use to determine and enforce document uniqueness.
|
362
|
Unless this field is marked with required="false", it will be a required field
|
363
|
-->
|
364
|
<uniqueKey>__indexrecordidentifier</uniqueKey>
|
365
|
|
366
|
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
|
367
|
<defaultSearchField>__all</defaultSearchField>
|
368
|
|
369
|
<!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
|
370
|
<solrQueryParser defaultOperator="OR"/>
|
371
|
|
372
|
<xsl:for-each select="./FIELD[(@type = 'ngramtext' or not(@type)) and not(@tokenizable = 'false')]">
|
373
|
<xsl:variable name="fieldname" select="translate(@name, $uppercase, $smallcase)"/>
|
374
|
<copyField source="{$fieldname}" dest="__all"/>
|
375
|
</xsl:for-each>
|
376
|
|
377
|
<xsl:for-each select="./FIELD[@spellcheck = 'true']">
|
378
|
<xsl:variable name="fieldname" select="translate(@name, $uppercase, $smallcase)"/>
|
379
|
<copyField source="{$fieldname}" dest="__spell"/>
|
380
|
</xsl:for-each>
|
381
|
|
382
|
<copyField source="cql.serverchoice" dest="__all"/>
|
383
|
<copyField source="__fulltext" dest="__all"/>
|
384
|
|
385
|
|
386
|
<!-- Similarity is the scoring routine for each document vs. a query.
|
387
|
A custom similarity may be specified here, but the default is fine
|
388
|
for most applications. -->
|
389
|
<!-- <similarity class="org.apache.lucene.search.DefaultSimilarity"/> -->
|
390
|
<!-- ... OR ...
|
391
|
Specify a SimilarityFactory class name implementation
|
392
|
allowing parameters to be used.
|
393
|
-->
|
394
|
<!--
|
395
|
<similarity class="com.example.solr.CustomSimilarityFactory">
|
396
|
<str name="paramkey">param value</str>
|
397
|
</similarity>
|
398
|
-->
|
399
|
|
400
|
|
401
|
</schema>
|
402
|
</xsl:template>
|
403
|
</xsl:stylesheet>
|