geoblacklight_sidecar_images 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +17 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +80 -0
  6. data/.travis.yml +29 -0
  7. data/Gemfile +47 -0
  8. data/LICENSE +201 -0
  9. data/README.md +45 -0
  10. data/Rakefile +37 -0
  11. data/app/assets/config/geoblacklight_sidecar_images_manifest.js +2 -0
  12. data/app/assets/images/geoblacklight_sidecar_images/.keep +0 -0
  13. data/app/assets/javascripts/geoblacklight_sidecar_images/application.js +13 -0
  14. data/app/assets/stylesheets/geoblacklight_sidecar_images/application.css +15 -0
  15. data/app/controllers/geoblacklight_sidecar_images/application_controller.rb +5 -0
  16. data/app/helpers/geoblacklight_sidecar_images/application_helper.rb +4 -0
  17. data/app/jobs/geoblacklight_sidecar_images/application_job.rb +4 -0
  18. data/app/mailers/geoblacklight_sidecar_images/application_mailer.rb +6 -0
  19. data/app/models/geoblacklight_sidecar_images/application_record.rb +5 -0
  20. data/app/views/layouts/geoblacklight_sidecar_images/application.html.erb +14 -0
  21. data/config/routes.rb +2 -0
  22. data/db/migrate/20180118203155_create_solr_document_sidecars.rb +12 -0
  23. data/geoblacklight_sidecar_images.gemspec +37 -0
  24. data/lib/generators/geoblacklight_sidecar_images/assets_generator.rb +31 -0
  25. data/lib/generators/geoblacklight_sidecar_images/example_docs_generator.rb +18 -0
  26. data/lib/generators/geoblacklight_sidecar_images/install_generator.rb +58 -0
  27. data/lib/generators/geoblacklight_sidecar_images/jobs_generator.rb +27 -0
  28. data/lib/generators/geoblacklight_sidecar_images/models_generator.rb +60 -0
  29. data/lib/generators/geoblacklight_sidecar_images/services_generator.rb +19 -0
  30. data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-image.png +0 -0
  31. data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-line.png +0 -0
  32. data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-mixed.png +0 -0
  33. data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-multipoint.png +0 -0
  34. data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-paper-map.png +0 -0
  35. data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-point.png +0 -0
  36. data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-polygon.png +0 -0
  37. data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-raster.png +0 -0
  38. data/lib/generators/geoblacklight_sidecar_images/templates/assets/javascripts/geoblacklight.js +9 -0
  39. data/lib/generators/geoblacklight_sidecar_images/templates/assets/stylesheets/geoblacklight.scss +3 -0
  40. data/lib/generators/geoblacklight_sidecar_images/templates/jobs/store_image_job.rb +8 -0
  41. data/lib/generators/geoblacklight_sidecar_images/templates/models/concerns/wms_rewrite_concern.rb +20 -0
  42. data/lib/generators/geoblacklight_sidecar_images/templates/models/solr_document_sidecar.rb +16 -0
  43. data/lib/generators/geoblacklight_sidecar_images/templates/services/image_service.rb +193 -0
  44. data/lib/generators/geoblacklight_sidecar_images/templates/services/image_service/dynamic_map_layer.rb +11 -0
  45. data/lib/generators/geoblacklight_sidecar_images/templates/services/image_service/iiif.rb +13 -0
  46. data/lib/generators/geoblacklight_sidecar_images/templates/services/image_service/image_map_layer.rb +13 -0
  47. data/lib/generators/geoblacklight_sidecar_images/templates/services/image_service/tiled_map_layer.rb +11 -0
  48. data/lib/generators/geoblacklight_sidecar_images/templates/services/image_service/wms.rb +24 -0
  49. data/lib/generators/geoblacklight_sidecar_images/templates/uploaders/image_uploader.rb +53 -0
  50. data/lib/generators/geoblacklight_sidecar_images/templates/views/catalog/_index_split_default.html.erb +27 -0
  51. data/lib/generators/geoblacklight_sidecar_images/uploaders_generator.rb +19 -0
  52. data/lib/generators/geoblacklight_sidecar_images/views_generator.rb +21 -0
  53. data/lib/geoblacklight_sidecar_images.rb +5 -0
  54. data/lib/geoblacklight_sidecar_images/engine.rb +5 -0
  55. data/lib/geoblacklight_sidecar_images/version.rb +3 -0
  56. data/lib/tasks/geoblacklight_sidecar_images_tasks.rake +76 -0
  57. data/solr/conf/_rest_managed.json +3 -0
  58. data/solr/conf/admin-extra.html +31 -0
  59. data/solr/conf/elevate.xml +36 -0
  60. data/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  61. data/solr/conf/protwords.txt +21 -0
  62. data/solr/conf/schema.xml +190 -0
  63. data/solr/conf/scripts.conf +24 -0
  64. data/solr/conf/solrconfig.xml +243 -0
  65. data/solr/conf/spellings.txt +2 -0
  66. data/solr/conf/stopwords.txt +58 -0
  67. data/solr/conf/stopwords_en.txt +58 -0
  68. data/solr/conf/synonyms.txt +31 -0
  69. data/solr/conf/xslt/example.xsl +132 -0
  70. data/solr/conf/xslt/example_atom.xsl +67 -0
  71. data/solr/conf/xslt/example_rss.xsl +66 -0
  72. data/solr/conf/xslt/luke.xsl +337 -0
  73. data/spec/fixtures/files/actual-papermap1.json +23 -0
  74. data/spec/fixtures/files/actual-point1.json +24 -0
  75. data/spec/fixtures/files/actual-polygon1.json +23 -0
  76. data/spec/fixtures/files/actual-raster1.json +37 -0
  77. data/spec/fixtures/files/baruch_ancestor1.json +46 -0
  78. data/spec/fixtures/files/baruch_ancestor2.json +46 -0
  79. data/spec/fixtures/files/baruch_documentation_download.json +49 -0
  80. data/spec/fixtures/files/esri-dynamic-layer-all-layers.json +36 -0
  81. data/spec/fixtures/files/esri-dynamic-layer-single-layer.json +37 -0
  82. data/spec/fixtures/files/esri-feature-layer.json +33 -0
  83. data/spec/fixtures/files/esri-image-map-layer.json +21 -0
  84. data/spec/fixtures/files/esri-tiled_map_layer.json +22 -0
  85. data/spec/fixtures/files/esri-wms-layer.json +33 -0
  86. data/spec/fixtures/files/harvard_raster.json +44 -0
  87. data/spec/fixtures/files/no_spatial.json +21 -0
  88. data/spec/fixtures/files/public_direct_download.json +28 -0
  89. data/spec/fixtures/files/public_iiif_princeton.json +36 -0
  90. data/spec/fixtures/files/public_polygon_mit.json +39 -0
  91. data/spec/fixtures/files/restricted-line.json +36 -0
  92. data/spec/fixtures/files/umich_iiif_jpg.json +28 -0
  93. data/spec/fixtures/files/umn_iiif_jpg.json +30 -0
  94. data/spec/fixtures/files/umn_metro_result1.json +37 -0
  95. data/spec/fixtures/files/umn_metro_result2.json +35 -0
  96. data/spec/fixtures/files/umn_state_result1.json +31 -0
  97. data/spec/fixtures/files/umn_state_result2.json +36 -0
  98. data/spec/models/solr_document_sidecar_spec.rb +13 -0
  99. data/spec/models/solr_document_spec.rb +14 -0
  100. data/spec/rails_helper.rb +59 -0
  101. data/spec/services/image_service_spec.rb +31 -0
  102. data/spec/spec_helper.rb +5 -0
  103. data/spec/test_app_templates/lib/generators/test_app_generator.rb +33 -0
  104. data/template.rb +13 -0
  105. metadata +395 -0
@@ -0,0 +1,24 @@
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
+ user=
17
+ solr_hostname=localhost
18
+ solr_port=8983
19
+ rsyncd_port=18983
20
+ data_dir=
21
+ webapp_name=solr
22
+ master_host=
23
+ master_data_dir=
24
+ master_status_dir=
@@ -0,0 +1,243 @@
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
+ For more details about configurations options that may appear in
20
+ this file, see http://wiki.apache.org/solr/SolrConfigXml.
21
+ -->
22
+ <config>
23
+
24
+ <!-- Controls what version of Lucene various components of Solr
25
+ adhere to. Generally, you want to use the latest version to
26
+ get all bug fixes and improvements. It is highly recommended
27
+ that you fully re-index after changing this setting as it can
28
+ affect both how text is indexed and queried.
29
+ -->
30
+ <luceneMatchVersion>6.1</luceneMatchVersion>
31
+
32
+ <lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lib" />
33
+ <lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lucene-libs" />
34
+
35
+ <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}"/>
36
+
37
+ <codecFactory class="solr.SchemaCodecFactory"/>
38
+ <schemaFactory class="ClassicIndexSchemaFactory"/>
39
+
40
+ <dataDir>${solr.blacklight-core.data.dir:}</dataDir>
41
+
42
+ <indexConfig>
43
+ <lockType>${solr.lock.type:native}</lockType>
44
+ </indexConfig>
45
+
46
+ <!-- The default high-performance update handler -->
47
+ <updateHandler class="solr.DirectUpdateHandler2">
48
+ <updateLog>
49
+ <str name="dir">${solr.ulog.dir:}</str>
50
+ </updateLog>
51
+ <autoCommit>
52
+ <maxTime>15000</maxTime>
53
+ <openSearcher>false</openSearcher>
54
+ </autoCommit>
55
+ </updateHandler>
56
+
57
+ <!-- realtime get handler, guaranteed to return the latest stored fields
58
+ of any document, without the need to commit or open a new searcher. The current
59
+ implementation relies on the updateLog feature being enabled. -->
60
+ <requestHandler name="/get" class="solr.RealTimeGetHandler">
61
+ <lst name="defaults">
62
+ <str name="omitHeader">true</str>
63
+ </lst>
64
+ </requestHandler>
65
+
66
+ <requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />
67
+
68
+ <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69
+ Query section - these settings control query time things like caches
70
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
71
+ <query>
72
+ <maxBooleanClauses>1024</maxBooleanClauses>
73
+ <filterCache class="solr.FastLRUCache" size="512" initialSize="512" autowarmCount="0"/>
74
+ <queryResultCache class="solr.LRUCache" size="512" initialSize="512" autowarmCount="0"/>
75
+ <documentCache class="solr.LRUCache" size="512" initialSize="512" autowarmCount="0"/>
76
+ <enableLazyFieldLoading>true</enableLazyFieldLoading>
77
+ <queryResultWindowSize>20</queryResultWindowSize>
78
+ <queryResultMaxDocsCached>200</queryResultMaxDocsCached>
79
+ <listener event="newSearcher" class="solr.QuerySenderListener">
80
+ <arr name="queries">
81
+ <lst><str name="q">stanford</str></lst>
82
+ <lst><str name="q">polygon</str></lst>
83
+ </arr>
84
+ </listener>
85
+ <listener event="firstSearcher" class="solr.QuerySenderListener">
86
+ <arr name="queries">
87
+ <lst>
88
+ <str name="q">static firstSearcher warming in solrconfig.xml</str>
89
+ </lst>
90
+ </arr>
91
+ </listener>
92
+ <useColdSearcher>false</useColdSearcher>
93
+ <maxWarmingSearchers>2</maxWarmingSearchers>
94
+ </query>
95
+
96
+ <requestDispatcher handleSelect="false">
97
+ <requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048000" formdataUploadLimitInKB="2048"/>
98
+ <httpCaching never304="true"/>
99
+ </requestDispatcher>
100
+
101
+ <requestHandler name="/search" class="solr.SearchHandler"/>
102
+
103
+ <requestHandler name="/select" class="solr.SearchHandler">
104
+ <lst name="defaults">
105
+ <int name="start">0</int>
106
+ <int name="rows">10</int>
107
+ <str name="wt">json</str>
108
+ <int name="indent">2</int>
109
+ <str name="defType">edismax</str>
110
+ <str name="echoParams">all</str>
111
+ <str name="mm">6&lt;-1 6&lt;90%</str>
112
+ <int name="qs">1</int>
113
+ <int name="ps">0</int>
114
+ <float name="tie">0.01</float>
115
+ <str name="fl">*,score</str>
116
+ <str name="sort">score desc, dc_title_sort asc</str>
117
+ <str name="q.alt">*:*</str>
118
+ <str name="qf">
119
+ text^1
120
+ dc_description_ti^2
121
+ dc_creator_tmi^3
122
+ dc_publisher_ti^3
123
+ dct_isPartOf_tmi^4
124
+ dc_subject_tmi^5
125
+ dct_spatial_tmi^5
126
+ dct_temporal_tmi^5
127
+ dc_title_ti^6
128
+ dc_rights_ti^7
129
+ dct_provenance_ti^8
130
+ layer_geom_type_ti^9
131
+ layer_slug_ti^10
132
+ dc_identifier_ti^10
133
+ </str>
134
+ <str name="pf"><!-- phrase boost within result set -->
135
+ text^1
136
+ dc_description_ti^2
137
+ dc_creator_tmi^3
138
+ dc_publisher_ti^3
139
+ dct_isPartOf_tmi^4
140
+ dc_subject_tmi^5
141
+ dct_spatial_tmi^5
142
+ dct_temporal_tmi^5
143
+ dc_title_ti^6
144
+ dc_rights_ti^7
145
+ dct_provenance_ti^8
146
+ layer_geom_type_ti^9
147
+ layer_slug_ti^10
148
+ dc_identifier_ti^10
149
+ </str>
150
+ <bool name="facet">true</bool>
151
+ <int name="facet.mincount">1</int>
152
+ <int name="facet.limit">10</int>
153
+ <str name="facet.field">dct_isPartOf_sm</str>
154
+ <str name="facet.field">dct_provenance_s</str>
155
+ <str name="facet.field">dct_spatial_sm</str>
156
+ <str name="facet.field">dc_creator_sm</str>
157
+ <str name="facet.field">dc_format_s</str>
158
+ <str name="facet.field">dc_language_s</str>
159
+ <str name="facet.field">dc_publisher_s</str>
160
+ <str name="facet.field">dc_rights_s</str>
161
+ <str name="facet.field">dc_subject_sm</str>
162
+ <str name="facet.field">layer_geom_type_s</str>
163
+ <str name="facet.field">solr_year_i</str>
164
+
165
+ <str name="spellcheck">true</str>
166
+ </lst>
167
+ <arr name="last-components">
168
+ <str>spellcheck</str>
169
+ </arr>
170
+ </requestHandler>
171
+
172
+ <!-- ping/healthcheck -->
173
+ <requestHandler name="/admin/ping" class="solr.PingRequestHandler">
174
+ <lst name="invariants">
175
+ <str name="q">solrpingquery</str>
176
+ </lst>
177
+ <lst name="defaults">
178
+ <str name="echoParams">all</str>
179
+ </lst>
180
+ <!-- An optional feature of the PingRequestHandler is to configure the
181
+ handler with a "healthcheckFile" which can be used to enable/disable
182
+ the PingRequestHandler.
183
+ relative paths are resolved against the data dir
184
+ -->
185
+ <str name="healthcheckFile">server-enabled.txt</str>
186
+ </requestHandler>
187
+
188
+ <requestHandler name="/analysis/field"
189
+ startup="lazy"
190
+ class="solr.FieldAnalysisRequestHandler" />
191
+
192
+ <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
193
+ <!-- a spellchecker built from a field of the main index -->
194
+ <lst name="spellchecker">
195
+ <str name="name">default</str>
196
+ <str name="field">spell</str>
197
+ <str name="classname">solr.DirectSolrSpellChecker</str>
198
+ <!-- the spellcheck distance measure used, the default is the internal levenshtein -->
199
+ <str name="distanceMeasure">internal</str>
200
+ <!-- minimum accuracy needed to be considered a valid spellcheck suggestion -->
201
+ <float name="accuracy">0.5</float>
202
+ <!-- the maximum #edits we consider when enumerating terms: can be 1 or 2 -->
203
+ <int name="maxEdits">2</int>
204
+ <!-- the minimum shared prefix when enumerating terms -->
205
+ <int name="minPrefix">1</int>
206
+ <!-- maximum number of inspections per result. -->
207
+ <int name="maxInspections">5</int>
208
+ <!-- minimum length of a query term to be considered for correction -->
209
+ <int name="minQueryLength">4</int>
210
+ <!-- maximum threshold of documents a query term can appear to be considered for correction -->
211
+ <float name="maxQueryFrequency">0.01</float>
212
+ <!-- uncomment this to require suggestions to occur in 1% of the documents
213
+ <float name="thresholdTokenFrequency">.01</float>
214
+ -->
215
+ </lst>
216
+ </searchComponent>
217
+
218
+ <searchComponent name="suggest" class="solr.SuggestComponent">
219
+ <lst name="suggester">
220
+ <str name="name">mySuggester</str>
221
+ <str name="lookupImpl">FuzzyLookupFactory</str>
222
+ <str name="suggestAnalyzerFieldType">textSuggest</str>
223
+ <str name="buildOnCommit">true</str>
224
+ <str name="field">suggest</str>
225
+ </lst>
226
+ </searchComponent>
227
+
228
+ <requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
229
+ <lst name="defaults">
230
+ <str name="suggest">true</str>
231
+ <str name="suggest.count">5</str>
232
+ <str name="suggest.dictionary">mySuggester</str>
233
+ </lst>
234
+ <arr name="components">
235
+ <str>suggest</str>
236
+ </arr>
237
+ </requestHandler>
238
+
239
+ <!-- Legacy config for the admin interface -->
240
+ <admin>
241
+ <defaultQuery>*:*</defaultQuery>
242
+ </admin>
243
+ </config>
@@ -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>