blacklight_oai_provider 0.1.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.rubocop.yml +39 -0
  4. data/.rubocop_todo.yml +130 -0
  5. data/.solr_wrapper +8 -0
  6. data/.travis.yml +16 -0
  7. data/Gemfile +34 -2
  8. data/README.md +131 -0
  9. data/Rakefile +25 -0
  10. data/VERSION +1 -1
  11. data/app/assets/{xsl → stylesheets/blacklight_oai_provider}/oai2.xsl +12 -5
  12. data/app/controllers/concerns/blacklight_oai_provider/controller.rb +38 -0
  13. data/app/models/concerns/blacklight_oai_provider/solr_document.rb +23 -0
  14. data/blacklight_oai_provider.gemspec +17 -10
  15. data/config/initializers/oai_patches.rb +20 -0
  16. data/lib/blacklight_oai_provider/engine.rb +15 -2
  17. data/lib/blacklight_oai_provider/exceptions.rb +9 -0
  18. data/lib/blacklight_oai_provider/resumption_token.rb +51 -0
  19. data/lib/blacklight_oai_provider/routes.rb +15 -0
  20. data/lib/blacklight_oai_provider/solr_document_provider.rb +2 -2
  21. data/lib/blacklight_oai_provider/solr_document_wrapper.rb +55 -27
  22. data/lib/blacklight_oai_provider/version.rb +1 -2
  23. data/lib/blacklight_oai_provider.rb +16 -14
  24. data/lib/generators/blacklight_oai_provider/install_generator.rb +27 -0
  25. data/lib/railties/blacklight_oai_provider.rake +14 -0
  26. data/solr/conf/_rest_managed.json +3 -0
  27. data/solr/conf/admin-extra.html +31 -0
  28. data/solr/conf/elevate.xml +36 -0
  29. data/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  30. data/solr/conf/protwords.txt +21 -0
  31. data/solr/conf/schema.xml +629 -0
  32. data/solr/conf/scripts.conf +24 -0
  33. data/solr/conf/solrconfig.xml +401 -0
  34. data/solr/conf/spellings.txt +2 -0
  35. data/solr/conf/stopwords.txt +58 -0
  36. data/solr/conf/stopwords_en.txt +58 -0
  37. data/solr/conf/synonyms.txt +31 -0
  38. data/solr/conf/xslt/example.xsl +132 -0
  39. data/solr/conf/xslt/example_atom.xsl +67 -0
  40. data/solr/conf/xslt/example_rss.xsl +66 -0
  41. data/solr/conf/xslt/luke.xsl +337 -0
  42. data/solr/sample_solr_documents.yml +2722 -0
  43. data/spec/controllers/catalog_controller_spec.rb +39 -0
  44. data/spec/features/html_rendering_spec.rb +24 -0
  45. data/spec/models/solr_document_spec.rb +43 -0
  46. data/spec/requests/get_record_spec.rb +47 -0
  47. data/spec/requests/identify_spec.rb +53 -0
  48. data/spec/requests/list_identifiers_spec.rb +80 -0
  49. data/spec/requests/list_metadata_formats_spec.rb +43 -0
  50. data/spec/requests/list_records_spec.rb +126 -0
  51. data/spec/spec_helper.rb +15 -38
  52. data/spec/test_app_templates/config/solr.yml +9 -0
  53. data/spec/test_app_templates/lib/generators/test_app_generator.rb +86 -0
  54. metadata +146 -87
  55. data/Gemfile.lock +0 -187
  56. data/README.rdoc +0 -74
  57. data/config/routes.rb +0 -5
  58. data/lib/blacklight_oai_provider/README.rdoc +0 -0
  59. data/lib/blacklight_oai_provider/controller_extension.rb +0 -29
  60. data/lib/blacklight_oai_provider/route_sets.rb +0 -13
  61. data/lib/blacklight_oai_provider/solr_document_extension.rb +0 -10
  62. data/lib/generators/blacklight_oai_provider/blacklight_oai_provider_generator.rb +0 -27
  63. data/spec/acceptance/blacklight_oai_provider_spec.rb +0 -49
  64. data/spec/integration/blacklight_stub_spec.rb +0 -10
  65. data/spec/internal/app/controllers/application_controller.rb +0 -4
  66. data/spec/internal/app/models/solr_document.rb +0 -3
  67. data/spec/internal/config/database.yml +0 -3
  68. data/spec/internal/config/routes.rb +0 -6
  69. data/spec/internal/config/solr.yml +0 -18
  70. data/spec/internal/db/combustion_test.sqlite +0 -0
  71. data/spec/internal/db/schema.rb +0 -53
  72. data/spec/internal/log/.gitignore +0 -1
  73. data/spec/internal/public/favicon.ico +0 -0
  74. data/spec/lib/solr_document_extension_spec.rb +0 -6
  75. data/spec/vcr_cassettes/solr.yml +0 -113
@@ -0,0 +1,401 @@
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 a stripped down config file used for a simple example...
21
+ It is *not* a good example to work from.
22
+ -->
23
+ <config>
24
+
25
+ <!-- Controls what version of Lucene various components of Solr
26
+ adhere to. Generally, you want to use the latest version to
27
+ get all bug fixes and improvements. It is highly recommended
28
+ that you fully re-index after changing this setting as it can
29
+ affect both how text is indexed and queried.
30
+ -->
31
+ <luceneMatchVersion>5.0.0</luceneMatchVersion>
32
+
33
+ <lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lib" />
34
+ <lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lucene-libs" />
35
+
36
+ <directoryFactory name="DirectoryFactory"
37
+ class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}">
38
+ </directoryFactory>
39
+
40
+ <codecFactory class="solr.SchemaCodecFactory"/>
41
+
42
+ <schemaFactory class="ClassicIndexSchemaFactory"/>
43
+
44
+
45
+ <dataDir>${solr.blacklight-core.data.dir:}</dataDir>
46
+
47
+ <requestDispatcher handleSelect="true" >
48
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
49
+ </requestDispatcher>
50
+
51
+ <requestHandler name="/analysis/field" startup="lazy" class="solr.FieldAnalysisRequestHandler" />
52
+
53
+ <!-- config for the admin interface -->
54
+ <admin>
55
+ <defaultQuery>*:*</defaultQuery>
56
+ </admin>
57
+
58
+ <!-- SearchHandler
59
+
60
+ http://wiki.apache.org/solr/SearchHandler
61
+
62
+ For processing Search Queries, the primary Request Handler
63
+ provided with Solr is "SearchHandler" It delegates to a sequent
64
+ of SearchComponents (see below) and supports distributed
65
+ queries across multiple shards
66
+ -->
67
+ <requestHandler name="search" class="solr.SearchHandler" default="true">
68
+ <!-- default values for query parameters can be specified, these
69
+ will be overridden by parameters in the request
70
+ -->
71
+ <lst name="defaults">
72
+ <str name="defType">dismax</str>
73
+ <str name="echoParams">explicit</str>
74
+ <int name="rows">10</int>
75
+
76
+ <str name="q.alt">*:*</str>
77
+ <str name="mm">2&lt;-1 5&lt;-2 6&lt;90%</str>
78
+
79
+ <!-- this qf and pf are used by default, if not otherwise specified by
80
+ client. The default blacklight_config will use these for the
81
+ "keywords" search. See the author_qf/author_pf, title_qf, etc
82
+ below, which the default blacklight_config will specify for
83
+ those searches. You may also be interested in:
84
+ http://wiki.apache.org/solr/LocalParams
85
+ -->
86
+
87
+ <str name="qf">
88
+ title_unstem_search^100000
89
+ subtitle_unstem_search^50000
90
+ title_t^25000
91
+ subtitle_t^10000
92
+ title_addl_unstem_search^5000
93
+ title_addl_t^2500
94
+ title_added_entry_unstem_search^1500
95
+ title_added_entry_t^1250
96
+ subject_topic_unstem_search^1000
97
+ subject_unstem_search^750
98
+ subject_topic_facet^625
99
+ subject_t^500
100
+ author_unstem_search^250
101
+ author_addl_unstem_search^250
102
+ author_t^100
103
+ author_addl_t^50
104
+ subject_addl_unstem_search^250
105
+ subject_addl_t^50
106
+ title_series_unstem_search^25
107
+ title_series_t^10
108
+ isbn_t
109
+ text
110
+ </str>
111
+ <str name="pf">
112
+ title_unstem_search^1000000
113
+ subtitle_unstem_search^500000
114
+ title_t^250000
115
+ subtitle_t^100000
116
+ title_addl_unstem_search^50000
117
+ title_addl_t^25000
118
+ title_added_entry_unstem_search^15000
119
+ title_added_entry_t^12500
120
+ subject_topic_unstem_search^10000
121
+ subject_unstem_search^7500
122
+ subject_topic_facet^6250
123
+ subject_t^5000
124
+ author_unstem_search^2500
125
+ author_addl_unstem_search^2500
126
+ author_t^1000
127
+ author_addl_t^500
128
+ subject_addl_unstem_search^2500
129
+ subject_addl_t^500
130
+ title_series_unstem_search^250
131
+ title_series_t^100
132
+ text^10
133
+ </str>
134
+ <str name="author_qf">
135
+ author_unstem_search^200
136
+ author_addl_unstem_search^50
137
+ author_t^20
138
+ author_addl_t
139
+ </str>
140
+ <str name="author_pf">
141
+ author_unstem_search^2000
142
+ author_addl_unstem_search^500
143
+ author_t^200
144
+ author_addl_t^10
145
+ </str>
146
+ <str name="title_qf">
147
+ title_unstem_search^50000
148
+ subtitle_unstem_search^25000
149
+ title_addl_unstem_search^10000
150
+ title_t^5000
151
+ subtitle_t^2500
152
+ title_addl_t^100
153
+ title_added_entry_unstem_search^50
154
+ title_added_entry_t^10
155
+ title_series_unstem_search^5
156
+ title_series_t
157
+ </str>
158
+ <str name="title_pf">
159
+ title_unstem_search^500000
160
+ subtitle_unstem_search^250000
161
+ title_addl_unstem_search^100000
162
+ title_t^50000
163
+ subtitle_t^25000
164
+ title_addl_t^1000
165
+ title_added_entry_unstem_search^500
166
+ title_added_entry_t^100
167
+ title_series_t^50
168
+ title_series_unstem_search^10
169
+ </str>
170
+ <str name="subject_qf">
171
+ subject_topic_unstem_search^200
172
+ subject_unstem_search^125
173
+ subject_topic_facet^100
174
+ subject_t^50
175
+ subject_addl_unstem_search^10
176
+ subject_addl_t
177
+ </str>
178
+ <str name="subject_pf">
179
+ subject_topic_unstem_search^2000
180
+ subject_unstem_search^1250
181
+ subject_t^1000
182
+ subject_topic_facet^500
183
+ subject_addl_unstem_search^100
184
+ subject_addl_t^10
185
+ </str>
186
+
187
+ <int name="ps">3</int>
188
+ <float name="tie">0.01</float>
189
+
190
+ <str name="fl">
191
+ id,
192
+ score,
193
+ author_display,
194
+ author_vern_display,
195
+ format,
196
+ isbn_t,
197
+ language_facet,
198
+ lc_callnum_display,
199
+ material_type_display,
200
+ published_display,
201
+ published_vern_display,
202
+ pub_date,
203
+ title_display,
204
+ title_vern_display,
205
+ subject_topic_facet,
206
+ subject_geo_facet,
207
+ subject_era_facet,
208
+ subtitle_display,
209
+ subtitle_vern_display,
210
+ url_fulltext_display,
211
+ url_suppl_display,
212
+ marc_display,
213
+ </str>
214
+
215
+ <str name="facet">true</str>
216
+ <str name="facet.mincount">1</str>
217
+ <str name="facet.field">format</str>
218
+ <str name="facet.field">lc_1letter_facet</str>
219
+ <str name="facet.field">lc_alpha_facet</str>
220
+ <str name="facet.field">lc_b4cutter_facet</str>
221
+ <str name="facet.field">language_facet</str>
222
+ <str name="facet.field">pub_date</str>
223
+ <str name="facet.field">subject_era_facet</str>
224
+ <str name="facet.field">subject_geo_facet</str>
225
+ <str name="facet.field">subject_topic_facet</str>
226
+
227
+ <str name="spellcheck">true</str>
228
+ <str name="spellcheck.dictionary">default</str>
229
+ <str name="spellcheck.onlyMorePopular">true</str>
230
+ <str name="spellcheck.extendedResults">true</str>
231
+ <str name="spellcheck.collate">false</str>
232
+ <str name="spellcheck.count">5</str>
233
+
234
+ </lst>
235
+ <!-- In addition to defaults, "appends" params can be specified
236
+ to identify values which should be appended to the list of
237
+ multi-val params from the query (or the existing "defaults").
238
+ -->
239
+ <!-- In this example, the param "fq=instock:true" would be appended to
240
+ any query time fq params the user may specify, as a mechanism for
241
+ partitioning the index, independent of any user selected filtering
242
+ that may also be desired (perhaps as a result of faceted searching).
243
+
244
+ NOTE: there is *absolutely* nothing a client can do to prevent these
245
+ "appends" values from being used, so don't use this mechanism
246
+ unless you are sure you always want it.
247
+ -->
248
+ <!--
249
+ <lst name="appends">
250
+ <str name="fq">inStock:true</str>
251
+ </lst>
252
+ -->
253
+ <!-- "invariants" are a way of letting the Solr maintainer lock down
254
+ the options available to Solr clients. Any params values
255
+ specified here are used regardless of what values may be specified
256
+ in either the query, the "defaults", or the "appends" params.
257
+
258
+ In this example, the facet.field and facet.query params would
259
+ be fixed, limiting the facets clients can use. Faceting is
260
+ not turned on by default - but if the client does specify
261
+ facet=true in the request, these are the only facets they
262
+ will be able to see counts for; regardless of what other
263
+ facet.field or facet.query params they may specify.
264
+
265
+ NOTE: there is *absolutely* nothing a client can do to prevent these
266
+ "invariants" values from being used, so don't use this mechanism
267
+ unless you are sure you always want it.
268
+ -->
269
+ <!--
270
+ <lst name="invariants">
271
+ <str name="facet.field">cat</str>
272
+ <str name="facet.field">manu_exact</str>
273
+ <str name="facet.query">price:[* TO 500]</str>
274
+ <str name="facet.query">price:[500 TO *]</str>
275
+ </lst>
276
+ -->
277
+ <!-- If the default list of SearchComponents is not desired, that
278
+ list can either be overridden completely, or components can be
279
+ prepended or appended to the default list. (see below)
280
+ -->
281
+ <!--
282
+ <arr name="components">
283
+ <str>nameOfCustomComponent1</str>
284
+ <str>nameOfCustomComponent2</str>
285
+ </arr>
286
+ -->
287
+ <arr name="last-components">
288
+ <str>spellcheck</str>
289
+ </arr>
290
+
291
+ </requestHandler>
292
+
293
+ <!-- Spell Check
294
+
295
+ The spell check component can return a list of alternative spelling
296
+ suggestions.
297
+
298
+ http://wiki.apache.org/solr/SpellCheckComponent
299
+ -->
300
+ <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
301
+
302
+ <str name="queryAnalyzerFieldType">textSpell</str>
303
+
304
+ <!-- Multiple "Spell Checkers" can be declared and used by this
305
+ component
306
+ -->
307
+
308
+ <!-- a spellchecker built from a field of the main index, and
309
+ written to disk
310
+ -->
311
+ <lst name="spellchecker">
312
+ <str name="name">default</str>
313
+ <str name="field">spell</str>
314
+ <str name="spellcheckIndexDir">./spell</str>
315
+ <str name="buildOnOptimize">true</str>
316
+ </lst>
317
+ <lst name="spellchecker">
318
+ <str name="name">author</str>
319
+ <str name="field">author_spell</str>
320
+ <str name="spellcheckIndexDir">./spell_author</str>
321
+ <str name="accuracy">0.7</str>
322
+ <str name="buildOnOptimize">true</str>
323
+ </lst>
324
+ <lst name="spellchecker">
325
+ <str name="name">subject</str>
326
+ <str name="field">subject_spell</str>
327
+ <str name="spellcheckIndexDir">./spell_subject</str>
328
+ <str name="accuracy">0.7</str>
329
+ <str name="buildOnOptimize">true</str>
330
+ </lst>
331
+ <lst name="spellchecker">
332
+ <str name="name">title</str>
333
+ <str name="field">title_spell</str>
334
+ <str name="spellcheckIndexDir">./spell_title</str>
335
+ <str name="accuracy">0.7</str>
336
+ <str name="buildOnOptimize">true</str>
337
+ </lst>
338
+
339
+ <!-- a spellchecker that uses a different distance measure -->
340
+ <!--
341
+ <lst name="spellchecker">
342
+ <str name="name">jarowinkler</str>
343
+ <str name="field">spell</str>
344
+ <str name="distanceMeasure">
345
+ org.apache.lucene.search.spell.JaroWinklerDistance
346
+ </str>
347
+ <str name="spellcheckIndexDir">spellcheckerJaro</str>
348
+ </lst>
349
+ -->
350
+
351
+ <!-- a spellchecker that use an alternate comparator
352
+
353
+ comparatorClass be one of:
354
+ 1. score (default)
355
+ 2. freq (Frequency first, then score)
356
+ 3. A fully qualified class name
357
+ -->
358
+ <!--
359
+ <lst name="spellchecker">
360
+ <str name="name">freq</str>
361
+ <str name="field">lowerfilt</str>
362
+ <str name="spellcheckIndexDir">spellcheckerFreq</str>
363
+ <str name="comparatorClass">freq</str>
364
+ <str name="buildOnCommit">true</str>
365
+ -->
366
+
367
+ <!-- A spellchecker that reads the list of words from a file -->
368
+ <!--
369
+ <lst name="spellchecker">
370
+ <str name="classname">solr.FileBasedSpellChecker</str>
371
+ <str name="name">file</str>
372
+ <str name="sourceLocation">spellings.txt</str>
373
+ <str name="characterEncoding">UTF-8</str>
374
+ <str name="spellcheckIndexDir">spellcheckerFile</str>
375
+ </lst>
376
+ -->
377
+ </searchComponent>
378
+
379
+ <searchComponent name="suggest" class="solr.SuggestComponent">
380
+ <lst name="suggester">
381
+ <str name="name">mySuggester</str>
382
+ <str name="lookupImpl">FuzzyLookupFactory</str>
383
+ <str name="suggestAnalyzerFieldType">textSuggest</str>
384
+ <str name="buildOnCommit">true</str>
385
+ <str name="field">suggest</str>
386
+ </lst>
387
+ </searchComponent>
388
+
389
+ <requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
390
+ <lst name="defaults">
391
+ <str name="suggest">true</str>
392
+ <str name="suggest.count">5</str>
393
+ <str name="suggest.dictionary">mySuggester</str>
394
+ </lst>
395
+ <arr name="components">
396
+ <str>suggest</str>
397
+ </arr>
398
+ </requestHandler>
399
+
400
+ </config>
401
+
@@ -0,0 +1,2 @@
1
+ pizza
2
+ history
@@ -0,0 +1,58 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright ownership.
4
+ # The ASF licenses this file to You under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with
6
+ # the License. You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ #-----------------------------------------------------------------------
17
+ # a couple of test stopwords to test that the words are really being
18
+ # configured from this file:
19
+ stopworda
20
+ stopwordb
21
+
22
+ #Standard english stop words taken from Lucene's StopAnalyzer
23
+ a
24
+ an
25
+ and
26
+ are
27
+ as
28
+ at
29
+ be
30
+ but
31
+ by
32
+ for
33
+ if
34
+ in
35
+ into
36
+ is
37
+ it
38
+ no
39
+ not
40
+ of
41
+ on
42
+ or
43
+ s
44
+ such
45
+ t
46
+ that
47
+ the
48
+ their
49
+ then
50
+ there
51
+ these
52
+ they
53
+ this
54
+ to
55
+ was
56
+ will
57
+ with
58
+
@@ -0,0 +1,58 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright ownership.
4
+ # The ASF licenses this file to You under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with
6
+ # the License. You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ #-----------------------------------------------------------------------
17
+ # a couple of test stopwords to test that the words are really being
18
+ # configured from this file:
19
+ stopworda
20
+ stopwordb
21
+
22
+ #Standard english stop words taken from Lucene's StopAnalyzer
23
+ a
24
+ an
25
+ and
26
+ are
27
+ as
28
+ at
29
+ be
30
+ but
31
+ by
32
+ for
33
+ if
34
+ in
35
+ into
36
+ is
37
+ it
38
+ no
39
+ not
40
+ of
41
+ on
42
+ or
43
+ s
44
+ such
45
+ t
46
+ that
47
+ the
48
+ their
49
+ then
50
+ there
51
+ these
52
+ they
53
+ this
54
+ to
55
+ was
56
+ will
57
+ with
58
+
@@ -0,0 +1,31 @@
1
+ # The ASF licenses this file to You under the Apache License, Version 2.0
2
+ # (the "License"); you may not use this file except in compliance with
3
+ # the License. You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ #-----------------------------------------------------------------------
14
+ #some test synonym mappings unlikely to appear in real input text
15
+ aaa => aaaa
16
+ bbb => bbbb1 bbbb2
17
+ ccc => cccc1,cccc2
18
+ a\=>a => b\=>b
19
+ a\,a => b\,b
20
+ fooaaa,baraaa,bazaaa
21
+
22
+ # Some synonym groups specific to this example
23
+ GB,gib,gigabyte,gigabytes
24
+ MB,mib,megabyte,megabytes
25
+ Television, Televisions, TV, TVs
26
+ #notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming
27
+ #after us won't split it into two words.
28
+
29
+ # Synonym mappings can be used for spelling correction too
30
+ pixima => pixma
31
+
@@ -0,0 +1,132 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+
3
+ <!--
4
+ * Licensed to the Apache Software Foundation (ASF) under one or more
5
+ * contributor license agreements. See the NOTICE file distributed with
6
+ * this work for additional information regarding copyright ownership.
7
+ * The ASF licenses this file to You under the Apache License, Version 2.0
8
+ * (the "License"); you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ -->
19
+
20
+ <!--
21
+ Simple transform of Solr query results to HTML
22
+ -->
23
+ <xsl:stylesheet version='1.0'
24
+ xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
25
+ >
26
+
27
+ <xsl:output media-type="text/html; charset=UTF-8" encoding="UTF-8"/>
28
+
29
+ <xsl:variable name="title" select="concat('Solr search results (',response/result/@numFound,' documents)')"/>
30
+
31
+ <xsl:template match='/'>
32
+ <html>
33
+ <head>
34
+ <title><xsl:value-of select="$title"/></title>
35
+ <xsl:call-template name="css"/>
36
+ </head>
37
+ <body>
38
+ <h1><xsl:value-of select="$title"/></h1>
39
+ <div class="note">
40
+ This has been formatted by the sample "example.xsl" transform -
41
+ use your own XSLT to get a nicer page
42
+ </div>
43
+ <xsl:apply-templates select="response/result/doc"/>
44
+ </body>
45
+ </html>
46
+ </xsl:template>
47
+
48
+ <xsl:template match="doc">
49
+ <xsl:variable name="pos" select="position()"/>
50
+ <div class="doc">
51
+ <table width="100%">
52
+ <xsl:apply-templates>
53
+ <xsl:with-param name="pos"><xsl:value-of select="$pos"/></xsl:with-param>
54
+ </xsl:apply-templates>
55
+ </table>
56
+ </div>
57
+ </xsl:template>
58
+
59
+ <xsl:template match="doc/*[@name='score']" priority="100">
60
+ <xsl:param name="pos"></xsl:param>
61
+ <tr>
62
+ <td class="name">
63
+ <xsl:value-of select="@name"/>
64
+ </td>
65
+ <td class="value">
66
+ <xsl:value-of select="."/>
67
+
68
+ <xsl:if test="boolean(//lst[@name='explain'])">
69
+ <xsl:element name="a">
70
+ <!-- can't allow whitespace here -->
71
+ <xsl:attribute name="href">javascript:toggle("<xsl:value-of select="concat('exp-',$pos)" />");</xsl:attribute>?</xsl:element>
72
+ <br/>
73
+ <xsl:element name="div">
74
+ <xsl:attribute name="class">exp</xsl:attribute>
75
+ <xsl:attribute name="id">
76
+ <xsl:value-of select="concat('exp-',$pos)" />
77
+ </xsl:attribute>
78
+ <xsl:value-of select="//lst[@name='explain']/str[position()=$pos]"/>
79
+ </xsl:element>
80
+ </xsl:if>
81
+ </td>
82
+ </tr>
83
+ </xsl:template>
84
+
85
+ <xsl:template match="doc/arr" priority="100">
86
+ <tr>
87
+ <td class="name">
88
+ <xsl:value-of select="@name"/>
89
+ </td>
90
+ <td class="value">
91
+ <ul>
92
+ <xsl:for-each select="*">
93
+ <li><xsl:value-of select="."/></li>
94
+ </xsl:for-each>
95
+ </ul>
96
+ </td>
97
+ </tr>
98
+ </xsl:template>
99
+
100
+
101
+ <xsl:template match="doc/*">
102
+ <tr>
103
+ <td class="name">
104
+ <xsl:value-of select="@name"/>
105
+ </td>
106
+ <td class="value">
107
+ <xsl:value-of select="."/>
108
+ </td>
109
+ </tr>
110
+ </xsl:template>
111
+
112
+ <xsl:template match="*"/>
113
+
114
+ <xsl:template name="css">
115
+ <script>
116
+ function toggle(id) {
117
+ var obj = document.getElementById(id);
118
+ obj.style.display = (obj.style.display != 'block') ? 'block' : 'none';
119
+ }
120
+ </script>
121
+ <style type="text/css">
122
+ body { font-family: "Lucida Grande", sans-serif }
123
+ td.name { font-style: italic; font-size:80%; }
124
+ td { vertical-align: top; }
125
+ ul { margin: 0px; margin-left: 1em; padding: 0px; }
126
+ .note { font-size:80%; }
127
+ .doc { margin-top: 1em; border-top: solid grey 1px; }
128
+ .exp { display: none; font-family: monospace; white-space: pre; }
129
+ </style>
130
+ </xsl:template>
131
+
132
+ </xsl:stylesheet>