blacklight-maps 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 (35) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +20 -0
  3. data/.travis.yml +18 -0
  4. data/Gemfile +16 -0
  5. data/LICENSE.txt +13 -0
  6. data/README.md +81 -0
  7. data/Rakefile +43 -0
  8. data/app/assets/javascripts/blacklight-maps.js +8 -0
  9. data/app/assets/javascripts/blacklight-maps/blacklight-maps-browse.js +141 -0
  10. data/app/assets/stylesheets/blacklight_maps/blacklight-maps.css.scss +4 -0
  11. data/app/assets/stylesheets/blacklight_maps/default.css.scss +24 -0
  12. data/app/helpers/blacklight_maps_helper.rb +36 -0
  13. data/app/views/catalog/_document_maps.html.erb +6 -0
  14. data/app/views/catalog/_index_maps.html.erb +9 -0
  15. data/blacklight-maps.gemspec +34 -0
  16. data/config/jetty.yml +7 -0
  17. data/config/locales/blacklight-maps.en.yml +5 -0
  18. data/config/routes.rb +4 -0
  19. data/docs/map-sidebar.png +0 -0
  20. data/docs/map-view.png +0 -0
  21. data/lib/blacklight/maps.rb +7 -0
  22. data/lib/blacklight/maps/engine.rb +32 -0
  23. data/lib/blacklight/maps/version.rb +5 -0
  24. data/lib/generators/blacklight_maps/install_generator.rb +25 -0
  25. data/lib/generators/blacklight_maps/templates/blacklight_maps.css.scss +3 -0
  26. data/lib/railties/blacklight_maps.rake +13 -0
  27. data/solr_conf/conf/schema.xml +673 -0
  28. data/solr_conf/conf/solrconfig.xml +523 -0
  29. data/spec/features/maps_spec.rb +79 -0
  30. data/spec/fixtures/sample_solr_documents.yml +2742 -0
  31. data/spec/helpers/blacklight_maps_helper_spec.rb +28 -0
  32. data/spec/spec_helper.rb +38 -0
  33. data/spec/test_app_templates/Gemfile.extra +7 -0
  34. data/spec/test_app_templates/lib/generators/test_app_generator.rb +23 -0
  35. metadata +268 -0
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'blacklight/maps/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "blacklight-maps"
8
+ spec.version = Blacklight::Maps::VERSION
9
+ spec.authors = ["Chris Beer", "Jack Reed"]
10
+ spec.email = ["cabeer@stanford.edu", "pjreed@stanford.edu"]
11
+ spec.summary = %q{Maps for Blacklight}
12
+ spec.homepage = ""
13
+ spec.license = "Apache 2.0"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "rails"
21
+ spec.add_dependency "blacklight", ">= 5.1.0"
22
+ spec.add_dependency "bootstrap-sass", "~> 3.0"
23
+ spec.add_dependency "leaflet-rails"
24
+ spec.add_dependency "leaflet-markercluster-rails"
25
+ spec.add_dependency "leaflet-sidebar-rails", "~> 0.0.2"
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.5"
28
+ spec.add_development_dependency "rake"
29
+ spec.add_development_dependency "rspec-rails"
30
+ spec.add_development_dependency "jettywrapper"
31
+ spec.add_development_dependency "engine_cart", "~> 0.3.2"
32
+ spec.add_development_dependency "capybara"
33
+ spec.add_development_dependency "poltergeist", ">= 1.5.0"
34
+ end
data/config/jetty.yml ADDED
@@ -0,0 +1,7 @@
1
+ development:
2
+ startup_wait: 15
3
+ jetty_port: 8983
4
+ test:
5
+ startup_wait: 60
6
+ jetty_port: <%= ENV['TEST_JETTY_PORT'] || 8888 %>
7
+ <%= ENV['TEST_JETTY_PATH'] ? "jetty_home: " + ENV['TEST_JETTY_PATH'] : '' %>
@@ -0,0 +1,5 @@
1
+ en:
2
+ blacklight:
3
+ search:
4
+ view:
5
+ maps: "Map"
data/config/routes.rb ADDED
@@ -0,0 +1,4 @@
1
+ Blacklight::Maps::Engine.routes.draw do
2
+
3
+ end
4
+
Binary file
data/docs/map-view.png ADDED
Binary file
@@ -0,0 +1,7 @@
1
+ require "blacklight/maps/version"
2
+
3
+ module Blacklight
4
+ module Maps
5
+ require 'blacklight/maps/engine'
6
+ end
7
+ end
@@ -0,0 +1,32 @@
1
+ require 'blacklight'
2
+ require 'leaflet-rails'
3
+ require 'leaflet-markercluster-rails'
4
+ require 'leaflet-sidebar-rails'
5
+
6
+
7
+ module Blacklight
8
+ module Maps
9
+ class Engine < Rails::Engine
10
+
11
+ # Set some default configurations
12
+ Blacklight::Configuration.default_values[:view].maps.placename_coord_field = "placename_coords"
13
+ Blacklight::Configuration.default_values[:view].maps.tileurl = "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
14
+ Blacklight::Configuration.default_values[:view].maps.mapattribution = 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
15
+ Blacklight::Configuration.default_values[:view].maps.maxzoom = 8
16
+
17
+ # Add our helpers
18
+ initializer 'blacklight-maps.helpers' do |app|
19
+ ActionView::Base.send :include, BlacklightMapsHelper
20
+ end
21
+
22
+ # This makes our rake tasks visible.
23
+ rake_tasks do
24
+ Dir.chdir(File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))) do
25
+ Dir.glob(File.join('railties', '*.rake')).each do |railtie|
26
+ load railtie
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,5 @@
1
+ module Blacklight
2
+ module Maps
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ require 'rails/generators'
2
+
3
+ module BlacklightMaps
4
+ class Install < Rails::Generators::Base
5
+
6
+ source_root File.expand_path('../templates', __FILE__)
7
+
8
+ desc "Install Blacklight-Maps"
9
+
10
+ def assets
11
+ copy_file "blacklight_maps.css.scss", "app/assets/stylesheets/blacklight_maps.css.scss"
12
+
13
+ unless IO.read("app/assets/javascripts/application.js").include?('blacklight-maps')
14
+ marker = IO.read("app/assets/javascripts/application.js").include?('turbolinks') ?
15
+ '//= require turbolinks' : "//= require jquery_ujs"
16
+ insert_into_file "app/assets/javascripts/application.js", :after => marker do
17
+ %q{
18
+ //
19
+ // Required by Blacklight-Maps
20
+ //= require blacklight-maps}
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require blacklight_maps/default
3
+ */
@@ -0,0 +1,13 @@
1
+ require 'rails/generators'
2
+ require 'generators/blacklight_maps/install_generator'
3
+
4
+ namespace :blacklight_maps do
5
+ namespace :solr do
6
+ desc "Put sample data into solr"
7
+ task :seed => :environment do
8
+ docs = YAML::load(File.open(File.expand_path(File.join('..', '..', '..', 'spec', 'fixtures', 'sample_solr_documents.yml'), __FILE__)))
9
+ Blacklight.solr.add docs
10
+ Blacklight.solr.commit
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,673 @@
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
+ PERFORMANCE NOTE: this schema includes many optional features and should not
32
+ be used for benchmarking. To improve performance one could
33
+ - set stored="false" for all fields possible (esp large fields) when you
34
+ only need to search on the field but don't need to return the original
35
+ value.
36
+ - set indexed="false" if you don't need to search on the field, but only
37
+ return the field as a result of searching on other indexed fields.
38
+ - remove all unneeded copyField statements
39
+ - for best index size and searching performance, set "index" to false
40
+ for all general text fields, use copyField to copy them to the
41
+ catchall "text" field, and use that for searching.
42
+ - For maximum indexing performance, use the StreamingUpdateSolrServer
43
+ java client.
44
+ - Remember to run the JVM in server mode, and use a higher logging level
45
+ that avoids logging every request
46
+ -->
47
+
48
+ <schema name="Blacklight Demo Index" version="1.5">
49
+ <!-- attribute "name" is the name of this schema and is only used for display purposes.
50
+ Applications should change this to reflect the nature of the search collection.
51
+ version="1.4" is Solr's version number for the schema syntax and semantics. It should
52
+ not normally be changed by applications.
53
+ 1.0: multiValued attribute did not exist, all fields are multiValued by nature
54
+ 1.1: multiValued attribute introduced, false by default
55
+ 1.2: omitTermFreqAndPositions attribute introduced, true by default except for text fields.
56
+ 1.3: removed optional field compress feature
57
+ 1.4: default auto-phrase (QueryParser feature) to off
58
+ -->
59
+
60
+ <types>
61
+ <!-- field type definitions. The "name" attribute is
62
+ just a label to be used by field definitions. The "class"
63
+ attribute and any other attributes determine the real
64
+ behavior of the fieldType.
65
+ Class names starting with "solr" refer to java classes in the
66
+ org.apache.solr.analysis package.
67
+ -->
68
+
69
+ <!-- The StrField type is not analyzed, but indexed/stored verbatim. -->
70
+ <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
71
+
72
+ <!-- boolean type: "true" or "false" -->
73
+ <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
74
+ <!--Binary data type. The data should be sent/retrieved in as Base64 encoded Strings -->
75
+ <fieldtype name="binary" class="solr.BinaryField"/>
76
+
77
+ <!-- The optional sortMissingLast and sortMissingFirst attributes are
78
+ currently supported on types that are sorted internally as strings
79
+ and on numeric types.
80
+ This includes "string","boolean", and, as of 3.5 (and 4.x),
81
+ int, float, long, date, double, including the "Trie" variants.
82
+ - If sortMissingLast="true", then a sort on this field will cause documents
83
+ without the field to come after documents with the field,
84
+ regardless of the requested sort order (asc or desc).
85
+ - If sortMissingFirst="true", then a sort on this field will cause documents
86
+ without the field to come before documents with the field,
87
+ regardless of the requested sort order.
88
+ - If sortMissingLast="false" and sortMissingFirst="false" (the default),
89
+ then default lucene sorting will be used which places docs without the
90
+ field first in an ascending sort and last in a descending sort.
91
+ -->
92
+
93
+ <!--
94
+ Default numeric field types. For faster range queries, consider the tint/tfloat/tlong/tdouble types.
95
+ -->
96
+ <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
97
+ <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
98
+ <fieldType name="long" class="solr.TrieLongField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
99
+ <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
100
+
101
+ <!--
102
+ Numeric field types that index each value at various levels of precision
103
+ to accelerate range queries when the number of values between the range
104
+ endpoints is large. See the javadoc for NumericRangeQuery for internal
105
+ implementation details.
106
+
107
+ Smaller precisionStep values (specified in bits) will lead to more tokens
108
+ indexed per value, slightly larger index size, and faster range queries.
109
+ A precisionStep of 0 disables indexing at different precision levels.
110
+ -->
111
+ <fieldType name="tint" class="solr.TrieIntField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
112
+ <fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
113
+ <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
114
+ <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
115
+
116
+ <!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
117
+ is a more restricted form of the canonical representation of dateTime
118
+ http://www.w3.org/TR/xmlschema-2/#dateTime
119
+ The trailing "Z" designates UTC time and is mandatory.
120
+ Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
121
+ All other components are mandatory.
122
+
123
+ Expressions can also be used to denote calculations that should be
124
+ performed relative to "NOW" to determine the value, ie...
125
+
126
+ NOW/HOUR
127
+ ... Round to the start of the current hour
128
+ NOW-1DAY
129
+ ... Exactly 1 day prior to now
130
+ NOW/DAY+6MONTHS+3DAYS
131
+ ... 6 months and 3 days in the future from the start of
132
+ the current day
133
+
134
+ Consult the DateField javadocs for more information.
135
+
136
+ Note: For faster range queries, consider the tdate type
137
+ -->
138
+ <fieldType name="date" class="solr.TrieDateField" omitNorms="true" precisionStep="0" positionIncrementGap="0"/>
139
+
140
+ <!-- A Trie based date field for faster date range queries and date faceting. -->
141
+ <fieldType name="tdate" class="solr.TrieDateField" omitNorms="true" precisionStep="6" positionIncrementGap="0"/>
142
+
143
+
144
+ <!--
145
+ Note:
146
+ These should only be used for compatibility with existing indexes (created with older Solr versions)
147
+ or if "sortMissingFirst" or "sortMissingLast" functionality is needed. Use Trie based fields instead.
148
+
149
+ Plain numeric field types that store and index the text
150
+ value verbatim (and hence don't support range queries, since the
151
+ lexicographic ordering isn't equal to the numeric ordering)
152
+ -->
153
+ <fieldType name="pint" class="solr.IntField" omitNorms="true"/>
154
+ <fieldType name="plong" class="solr.LongField" omitNorms="true"/>
155
+ <fieldType name="pfloat" class="solr.FloatField" omitNorms="true"/>
156
+ <fieldType name="pdouble" class="solr.DoubleField" omitNorms="true"/>
157
+ <fieldType name="pdate" class="solr.DateField" sortMissingLast="true" omitNorms="true"/>
158
+
159
+ <!-- The "RandomSortField" is not used to store or search any
160
+ data. You can declare fields of this type it in your schema
161
+ to generate pseudo-random orderings of your docs for sorting
162
+ purposes. The ordering is generated based on the field name
163
+ and the version of the index, As long as the index version
164
+ remains unchanged, and the same field name is reused,
165
+ the ordering of the docs will be consistent.
166
+ If you want different psuedo-random orderings of documents,
167
+ for the same version of the index, use a dynamicField and
168
+ change the name
169
+ -->
170
+ <fieldType name="random" class="solr.RandomSortField" indexed="true" />
171
+
172
+ <!-- solr.TextField allows the specification of custom text analyzers
173
+ specified as a tokenizer and a list of token filters. Different
174
+ analyzers may be specified for indexing and querying.
175
+
176
+ The optional positionIncrementGap puts space between multiple fields of
177
+ this type on the same document, with the purpose of preventing false phrase
178
+ matching across fields.
179
+
180
+ For more info on customizing your analyzer chain, please see
181
+ http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
182
+ -->
183
+ <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
184
+ <analyzer>
185
+ <tokenizer class="solr.StandardTokenizerFactory"/>
186
+ <filter class="solr.ICUFoldingFilterFactory" />
187
+ <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
188
+ <filter class="solr.SnowballPorterFilterFactory" language="English" />
189
+ </analyzer>
190
+ </fieldType>
191
+
192
+ <!-- One can also specify an existing Analyzer class that has a
193
+ default constructor via the class attribute on the analyzer element
194
+ <fieldType name="text_greek" class="solr.TextField">
195
+ <analyzer class="org.apache.lucene.analysis.el.GreekAnalyzer"/>
196
+ </fieldType>
197
+ -->
198
+
199
+ <!-- A text field that only splits on whitespace for exact matching of words -->
200
+ <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
201
+ <analyzer>
202
+ <tokenizer class="solr.WhitespaceTokenizerFactory"/>
203
+ </analyzer>
204
+ </fieldType>
205
+
206
+ <!-- A general text field that has reasonable, generic
207
+ cross-language defaults: it tokenizes with StandardTokenizer,
208
+ removes stop words from case-insensitive "stopwords.txt"
209
+ (empty by default), and down cases. At query time only, it
210
+ also applies synonyms. -->
211
+ <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
212
+ <analyzer type="index">
213
+ <tokenizer class="solr.StandardTokenizerFactory"/>
214
+ <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
215
+ <!-- in this example, we will only use synonyms at query time
216
+ <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
217
+ -->
218
+ <filter class="solr.LowerCaseFilterFactory"/>
219
+ </analyzer>
220
+ <analyzer type="query">
221
+ <tokenizer class="solr.StandardTokenizerFactory"/>
222
+ <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
223
+ <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
224
+ <filter class="solr.LowerCaseFilterFactory"/>
225
+ </analyzer>
226
+ </fieldType>
227
+
228
+ <!-- A text field with defaults appropriate for English: it
229
+ tokenizes with StandardTokenizer, removes English stop words
230
+ (stopwords_en.txt), down cases, protects words from protwords.txt, and
231
+ finally applies Porter's stemming. The query time analyzer
232
+ also applies synonyms from synonyms.txt. -->
233
+ <fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
234
+ <analyzer type="index">
235
+ <tokenizer class="solr.StandardTokenizerFactory"/>
236
+ <!-- in this example, we will only use synonyms at query time
237
+ <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
238
+ -->
239
+ <!-- Case insensitive stop word removal.
240
+ add enablePositionIncrements=true in both the index and query
241
+ analyzers to leave a 'gap' for more accurate phrase queries.
242
+ -->
243
+ <filter class="solr.StopFilterFactory"
244
+ ignoreCase="true"
245
+ words="stopwords_en.txt"
246
+ enablePositionIncrements="true"
247
+ />
248
+ <filter class="solr.LowerCaseFilterFactory"/>
249
+ <filter class="solr.EnglishPossessiveFilterFactory"/>
250
+ <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
251
+ <!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory:
252
+ <filter class="solr.EnglishMinimalStemFilterFactory"/>
253
+ -->
254
+ <filter class="solr.PorterStemFilterFactory"/>
255
+ </analyzer>
256
+ <analyzer type="query">
257
+ <tokenizer class="solr.StandardTokenizerFactory"/>
258
+ <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
259
+ <filter class="solr.StopFilterFactory"
260
+ ignoreCase="true"
261
+ words="stopwords_en.txt"
262
+ enablePositionIncrements="true"
263
+ />
264
+ <filter class="solr.LowerCaseFilterFactory"/>
265
+ <filter class="solr.EnglishPossessiveFilterFactory"/>
266
+ <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
267
+ <!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory:
268
+ <filter class="solr.EnglishMinimalStemFilterFactory"/>
269
+ -->
270
+ <filter class="solr.PorterStemFilterFactory"/>
271
+ </analyzer>
272
+ </fieldType>
273
+
274
+ <!-- A text field with defaults appropriate for English, plus
275
+ aggressive word-splitting and autophrase features enabled.
276
+ This field is just like text_en, except it adds
277
+ WordDelimiterFilter to enable splitting and matching of
278
+ words on case-change, alpha numeric boundaries, and
279
+ non-alphanumeric chars. This means certain compound word
280
+ cases will work, for example query "wi fi" will match
281
+ document "WiFi" or "wi-fi". However, other cases will still
282
+ not match, for example if the query is "wifi" and the
283
+ document is "wi fi" or if the query is "wi-fi" and the
284
+ document is "wifi".
285
+ -->
286
+ <fieldType name="text_en_splitting" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
287
+ <analyzer type="index">
288
+ <tokenizer class="solr.WhitespaceTokenizerFactory"/>
289
+ <!-- in this example, we will only use synonyms at query time
290
+ <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
291
+ -->
292
+ <!-- Case insensitive stop word removal.
293
+ add enablePositionIncrements=true in both the index and query
294
+ analyzers to leave a 'gap' for more accurate phrase queries.
295
+ -->
296
+ <filter class="solr.StopFilterFactory"
297
+ ignoreCase="true"
298
+ words="stopwords_en.txt"
299
+ enablePositionIncrements="true"
300
+ />
301
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
302
+ <filter class="solr.LowerCaseFilterFactory"/>
303
+ <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
304
+ <filter class="solr.PorterStemFilterFactory"/>
305
+ </analyzer>
306
+ <analyzer type="query">
307
+ <tokenizer class="solr.WhitespaceTokenizerFactory"/>
308
+ <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
309
+ <filter class="solr.StopFilterFactory"
310
+ ignoreCase="true"
311
+ words="stopwords_en.txt"
312
+ enablePositionIncrements="true"
313
+ />
314
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
315
+ <filter class="solr.LowerCaseFilterFactory"/>
316
+ <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
317
+ <filter class="solr.PorterStemFilterFactory"/>
318
+ </analyzer>
319
+ </fieldType>
320
+
321
+ <!-- Less flexible matching, but less false matches. Probably not ideal for product names,
322
+ but may be good for SKUs. Can insert dashes in the wrong place and still match. -->
323
+ <fieldType name="text_en_splitting_tight" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
324
+ <analyzer>
325
+ <tokenizer class="solr.WhitespaceTokenizerFactory"/>
326
+ <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
327
+ <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_en.txt"/>
328
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
329
+ <filter class="solr.LowerCaseFilterFactory"/>
330
+ <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
331
+ <filter class="solr.EnglishMinimalStemFilterFactory"/>
332
+ <!-- this filter can remove any duplicate tokens that appear at the same position - sometimes
333
+ possible with WordDelimiterFilter in conjuncton with stemming. -->
334
+ <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
335
+ </analyzer>
336
+ </fieldType>
337
+
338
+ <!-- Just like text_general except it reverses the characters of
339
+ each token, to enable more efficient leading wildcard queries. -->
340
+ <fieldType name="text_general_rev" class="solr.TextField" positionIncrementGap="100">
341
+ <analyzer type="index">
342
+ <tokenizer class="solr.StandardTokenizerFactory"/>
343
+ <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
344
+ <filter class="solr.LowerCaseFilterFactory"/>
345
+ <filter class="solr.ReversedWildcardFilterFactory" withOriginal="true"
346
+ maxPosAsterisk="3" maxPosQuestion="2" maxFractionAsterisk="0.33"/>
347
+ </analyzer>
348
+ <analyzer type="query">
349
+ <tokenizer class="solr.StandardTokenizerFactory"/>
350
+ <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
351
+ <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
352
+ <filter class="solr.LowerCaseFilterFactory"/>
353
+ </analyzer>
354
+ </fieldType>
355
+
356
+ <fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" >
357
+ <analyzer>
358
+ <tokenizer class="solr.StandardTokenizerFactory"/>
359
+ <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
360
+ <filter class="solr.StandardFilterFactory"/>
361
+ <filter class="solr.LowerCaseFilterFactory"/>
362
+ <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
363
+ </analyzer>
364
+ </fieldType>
365
+
366
+ <!-- charFilter + WhitespaceTokenizer -->
367
+ <!--
368
+ <fieldType name="text_char_norm" class="solr.TextField" positionIncrementGap="100" >
369
+ <analyzer>
370
+ <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
371
+ <tokenizer class="solr.WhitespaceTokenizerFactory"/>
372
+ </analyzer>
373
+ </fieldType>
374
+ -->
375
+
376
+ <!-- This is an example of using the KeywordTokenizer along
377
+ With various TokenFilterFactories to produce a sortable field
378
+ that does not include some properties of the source text
379
+ -->
380
+ <fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
381
+ <analyzer>
382
+ <!-- KeywordTokenizer does no actual tokenizing, so the entire
383
+ input string is preserved as a single token
384
+ -->
385
+ <tokenizer class="solr.KeywordTokenizerFactory"/>
386
+ <!-- The LowerCase TokenFilter does what you expect, which can be
387
+ when you want your sorting to be case insensitive
388
+ -->
389
+ <filter class="solr.LowerCaseFilterFactory" />
390
+ <!-- The TrimFilter removes any leading or trailing whitespace -->
391
+ <filter class="solr.TrimFilterFactory" />
392
+ <!-- The PatternReplaceFilter gives you the flexibility to use
393
+ Java Regular expression to replace any sequence of characters
394
+ matching a pattern with an arbitrary replacement string,
395
+ which may include back references to portions of the original
396
+ string matched by the pattern.
397
+
398
+ See the Java Regular Expression documentation for more
399
+ information on pattern and replacement string syntax.
400
+
401
+ http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/package-summary.html
402
+ -->
403
+ <filter class="solr.PatternReplaceFilterFactory"
404
+ pattern="([^a-z])" replacement="" replace="all"
405
+ />
406
+ </analyzer>
407
+ </fieldType>
408
+
409
+ <fieldtype name="phonetic" stored="false" indexed="true" class="solr.TextField" >
410
+ <analyzer>
411
+ <tokenizer class="solr.StandardTokenizerFactory"/>
412
+ <filter class="solr.DoubleMetaphoneFilterFactory" inject="false"/>
413
+ </analyzer>
414
+ </fieldtype>
415
+
416
+ <fieldtype name="payloads" stored="false" indexed="true" class="solr.TextField" >
417
+ <analyzer>
418
+ <tokenizer class="solr.WhitespaceTokenizerFactory"/>
419
+ <!--
420
+ The DelimitedPayloadTokenFilter can put payloads on tokens... for example,
421
+ a token of "foo|1.4" would be indexed as "foo" with a payload of 1.4f
422
+ Attributes of the DelimitedPayloadTokenFilterFactory :
423
+ "delimiter" - a one character delimiter. Default is | (pipe)
424
+ "encoder" - how to encode the following value into a playload
425
+ float -> org.apache.lucene.analysis.payloads.FloatEncoder,
426
+ integer -> o.a.l.a.p.IntegerEncoder
427
+ identity -> o.a.l.a.p.IdentityEncoder
428
+ Fully Qualified class name implementing PayloadEncoder, Encoder must have a no arg constructor.
429
+ -->
430
+ <filter class="solr.DelimitedPayloadTokenFilterFactory" encoder="float"/>
431
+ </analyzer>
432
+ </fieldtype>
433
+
434
+ <!-- lowercases the entire field value, keeping it as a single token. -->
435
+ <fieldType name="lowercase" class="solr.TextField" positionIncrementGap="100">
436
+ <analyzer>
437
+ <tokenizer class="solr.KeywordTokenizerFactory"/>
438
+ <filter class="solr.LowerCaseFilterFactory" />
439
+ </analyzer>
440
+ </fieldType>
441
+
442
+ <fieldType name="text_path" class="solr.TextField" positionIncrementGap="100">
443
+ <analyzer>
444
+ <tokenizer class="solr.PathHierarchyTokenizerFactory"/>
445
+ </analyzer>
446
+ </fieldType>
447
+
448
+ <!-- since fields of this type are by default not stored or indexed,
449
+ any data added to them will be ignored outright. -->
450
+ <fieldtype name="ignored" stored="false" indexed="false" multiValued="true" class="solr.StrField" />
451
+
452
+ <!-- This point type indexes the coordinates as separate fields (subFields)
453
+ If subFieldType is defined, it references a type, and a dynamic field
454
+ definition is created matching *___<typename>. Alternately, if
455
+ subFieldSuffix is defined, that is used to create the subFields.
456
+ Example: if subFieldType="double", then the coordinates would be
457
+ indexed in fields myloc_0___double,myloc_1___double.
458
+ Example: if subFieldSuffix="_d" then the coordinates would be indexed
459
+ in fields myloc_0_d,myloc_1_d
460
+ The subFields are an implementation detail of the fieldType, and end
461
+ users normally should not need to know about them.
462
+ -->
463
+ <fieldType name="point" class="solr.PointType" dimension="2" subFieldSuffix="_d"/>
464
+
465
+ <!-- A specialized field for geospatial search. If indexed, this fieldType must not be multivalued. -->
466
+ <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
467
+
468
+ <!--
469
+ A Geohash is a compact representation of a latitude longitude pair in a single field.
470
+ See http://wiki.apache.org/solr/SpatialSearch
471
+ -->
472
+ <fieldtype name="geohash" class="solr.GeoHashField"/>
473
+ </types>
474
+
475
+
476
+ <fields>
477
+ <!-- Valid attributes for fields:
478
+ name: mandatory - the name for the field
479
+ type: mandatory - the name of a previously defined type from the
480
+ <types> section
481
+ indexed: true if this field should be indexed (searchable or sortable)
482
+ stored: true if this field should be retrievable
483
+ multiValued: true if this field may contain multiple values per document
484
+ omitNorms: (expert) set to true to omit the norms associated with
485
+ this field (this disables length normalization and index-time
486
+ boosting for the field, and saves some memory). Only full-text
487
+ fields or fields that need an index-time boost need norms.
488
+ termVectors: [false] set to true to store the term vector for a
489
+ given field.
490
+ When using MoreLikeThis, fields used for similarity should be
491
+ stored for best performance.
492
+ termPositions: Store position information with the term vector.
493
+ This will increase storage costs.
494
+ termOffsets: Store offset information with the term vector. This
495
+ will increase storage costs.
496
+ default: a value that should be used if no value is specified
497
+ when adding a document.
498
+ -->
499
+
500
+ <!-- NOTE: this is not a full list of fields in the index; dynamic fields are also used -->
501
+ <field name="id" type="string" indexed="true" stored="true" required="true" />
502
+ <field name="timestamp" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/>
503
+ <!-- default, catch all search field -->
504
+ <field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
505
+
506
+ <!-- these display fields are NOT multi-valued -->
507
+ <field name="marc_display" type="string" indexed="false" stored="true" multiValued="false"/>
508
+ <field name="title_display" type="string" indexed="false" stored="true" multiValued="false"/>
509
+ <field name="title_vern_display" type="string" indexed="false" stored="true" multiValued="false"/>
510
+ <field name="subtitle_display" type="string" indexed="false" stored="true" multiValued="false"/>
511
+ <field name="subtitle_vern_display" type="string" indexed="false" stored="true" multiValued="false"/>
512
+ <field name="author_display" type="string" indexed="false" stored="true" multiValued="false"/>
513
+ <field name="author_vern_display" type="string" indexed="false" stored="true" multiValued="false"/>
514
+
515
+ <!-- these fields are also used for display, so they must be stored -->
516
+ <field name="isbn_t" type="text" indexed="true" stored="true" multiValued="true"/>
517
+ <field name="language_facet" type="string" indexed="true" stored="true" multiValued="true" />
518
+ <field name="subject_topic_facet" type="string" indexed="true" stored="true" multiValued="true" />
519
+ <field name="subject_era_facet" type="string" indexed="true" stored="true" multiValued="true" />
520
+ <field name="subject_geo_facet" type="string" indexed="true" stored="true" multiValued="true" />
521
+ <!-- pub_date is used for facet and display so it must be indexed and stored -->
522
+ <field name="pub_date" type="string" indexed="true" stored="true" multiValued="true"/>
523
+ <!-- pub_date sort uses new trie-based int fields, which are recommended for any int and are displayable, sortable, and range-quer
524
+ we use 'tint' for faster range-queries. -->
525
+ <field name="pub_date_sort" type="tint" indexed="true" stored="true" multiValued="false"/>
526
+
527
+ <!-- format is used for facet, display, and choosing which partial to use for the show view, so it must be stored and indexed -->
528
+ <field name="format" type="string" indexed="true" stored="true"/>
529
+
530
+ <!-- addition -->
531
+ <field name="placename_coords" type="string" indexed="true" stored="true" multiValued="true"/>
532
+
533
+ <!-- Dynamic field definitions. If a field name is not found, dynamicFields
534
+ will be used if the name matches any of the patterns.
535
+ RESTRICTION: the glob-like pattern in the name attribute must have
536
+ a "*" only at the start or the end.
537
+ EXAMPLE: name="*_i" will match any field ending in _i (like myid_i, z_i)
538
+ Longer patterns will be matched first. if equal size patterns
539
+ both match, the first appearing in the schema will be used. -->
540
+ <dynamicField name="*_i" type="int" indexed="true" stored="true"/>
541
+ <dynamicField name="*_s" type="string" indexed="true" stored="true"/>
542
+ <dynamicField name="*_l" type="long" indexed="true" stored="true"/>
543
+ <dynamicField name="*_t" type="text" indexed="true" stored="true" multiValued="true"/>
544
+ <dynamicField name="*_txt" type="text_general" indexed="true" stored="true" multiValued="true"/>
545
+ <dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
546
+ <dynamicField name="*_f" type="float" indexed="true" stored="true"/>
547
+ <dynamicField name="*_d" type="double" indexed="true" stored="true"/>
548
+
549
+ <!-- Type used to index the lat and lon components for the "location" FieldType -->
550
+ <dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false"/>
551
+
552
+ <dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
553
+ <dynamicField name="*_p" type="location" indexed="true" stored="true"/>
554
+
555
+ <!-- some trie-coded dynamic fields for faster range queries -->
556
+ <dynamicField name="*_ti" type="tint" indexed="true" stored="true"/>
557
+ <dynamicField name="*_tl" type="tlong" indexed="true" stored="true"/>
558
+ <dynamicField name="*_tf" type="tfloat" indexed="true" stored="true"/>
559
+ <dynamicField name="*_td" type="tdouble" indexed="true" stored="true"/>
560
+ <dynamicField name="*_tdt" type="tdate" indexed="true" stored="true"/>
561
+
562
+ <dynamicField name="*_pi" type="pint" indexed="true" stored="true"/>
563
+
564
+ <dynamicField name="ignored_*" type="ignored" multiValued="true"/>
565
+ <dynamicField name="attr_*" type="text_general" indexed="true" stored="true" multiValued="true"/>
566
+
567
+ <dynamicField name="random_*" type="random" />
568
+
569
+ <dynamicField name="*_display" type="string" indexed="false" stored="true" multiValued="true" />
570
+ <dynamicField name="*_facet" type="string" indexed="true" stored="false" multiValued="true" />
571
+ <dynamicField name="*_sort" type="alphaOnlySort" indexed="true" stored="false" multiValued="false" />
572
+ <dynamicField name="*_unstem_search" type="text_general" indexed="true" stored="false" multiValued="true" />
573
+ <dynamicField name="*spell" type="textSpell" indexed="true" stored="false" multiValued="true" />
574
+
575
+ <!-- uncomment the following to ignore any fields that don't already match an existing
576
+ field name or dynamic field, rather than reporting them as an error.
577
+ alternately, change the type="ignored" to some other type e.g. "text" if you want
578
+ unknown fields indexed and/or stored by default -->
579
+ <!--dynamicField name="*" type="ignored" multiValued="true" /-->
580
+
581
+ </fields>
582
+
583
+ <!-- Field to use to determine and enforce document uniqueness.
584
+ Unless this field is marked with required="false", it will be a required field
585
+ -->
586
+ <uniqueKey>id</uniqueKey>
587
+
588
+ <!-- field for the QueryParser to use when an explicit fieldname is absent -->
589
+ <defaultSearchField>text</defaultSearchField>
590
+
591
+ <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
592
+ <solrQueryParser defaultOperator="OR"/>
593
+
594
+ <!-- copyField commands copy one field to another at the time a document
595
+ is added to the index. It's used either to index the same field differently,
596
+ or to add multiple fields to the same field for easier/faster searching. -->
597
+ <!-- Copy Fields -->
598
+
599
+ <!-- unstemmed fields -->
600
+ <copyField source="title_t" dest="title_unstem_search"/>
601
+ <copyField source="subtitle_t" dest="subtitle_unstem_search"/>
602
+ <copyField source="title_addl_t" dest="title_addl_unstem_search"/>
603
+ <copyField source="title_added_entry_t" dest="title_added_entry_unstem_search"/>
604
+ <copyField source="title_series_t" dest="title_series_unstem_search"/>
605
+ <copyField source="author_t" dest="author_unstem_search"/>
606
+ <copyField source="author_addl_t" dest="author_addl_unstem_search"/>
607
+ <copyField source="subject_t" dest="subject_unstem_search"/>
608
+ <copyField source="subject_addl_t" dest="subject_addl_unstem_search"/>
609
+ <copyField source="subject_topic_facet" dest="subject_topic_unstem_search"/>
610
+
611
+ <!-- sort fields -->
612
+ <copyField source="pub_date" dest="pub_date_sort"/>
613
+
614
+
615
+ <!-- spellcheck fields -->
616
+ <!-- default spell check; should match fields for default request handler -->
617
+ <!-- it won't work with a copy of a copy field -->
618
+ <copyField source="*_t" dest="spell"/>
619
+ <copyField source="*_facet" dest="spell"/>
620
+ <!-- title spell check; should match fields for title request handler -->
621
+ <copyField source="title_t" dest="title_spell"/>
622
+ <copyField source="subtitle_t" dest="title_spell"/>
623
+ <copyField source="addl_titles_t" dest="title_spell"/>
624
+ <copyField source="title_added_entry_t" dest="title_spell"/>
625
+ <copyField source="title_series_t" dest="title_spell"/>
626
+ <!-- author spell check; should match fields for author request handler -->
627
+ <copyField source="author_t" dest="author_spell"/>
628
+ <copyField source="author_addl_t" dest="author_spell"/>
629
+ <!-- subject spell check; should match fields for subject request handler -->
630
+ <copyField source="subject_topic_facet" dest="subject_spell"/>
631
+ <copyField source="subject_t" dest="subject_spell"/>
632
+ <copyField source="subject_addl_t" dest="subject_spell"/>
633
+
634
+ <!-- OpenSearch query field should match request handler search fields -->
635
+ <copyField source="title_t" dest="opensearch_display"/>
636
+ <copyField source="subtitle_t" dest="opensearch_display"/>
637
+ <copyField source="addl_titles_t" dest="opensearch_display"/>
638
+ <copyField source="title_added_entry_t" dest="opensearch_display"/>
639
+ <copyField source="title_series_t" dest="opensearch_display"/>
640
+ <copyField source="author_t" dest="opensearch_display"/>
641
+ <copyField source="author_addl_t" dest="opensearch_display"/>
642
+ <copyField source="subject_topic_facet" dest="opensearch_display"/>
643
+ <copyField source="subject_t" dest="opensearch_display"/>
644
+ <copyField source="subject_addl_t" dest="opensearch_display"/>
645
+
646
+
647
+ <!-- Above, multiple source fields are copied to the [text] field.
648
+ Another way to map multiple source fields to the same
649
+ destination field is to use the dynamic field syntax.
650
+ copyField also supports a maxChars to copy setting. -->
651
+
652
+ <!-- <copyField source="*_t" dest="text" maxChars="3000"/> -->
653
+
654
+ <!-- copy name to alphaNameSort, a field designed for sorting by name -->
655
+ <!-- <copyField source="name" dest="alphaNameSort"/> -->
656
+
657
+
658
+ <!-- Similarity is the scoring routine for each document vs. a query.
659
+ A custom similarity may be specified here, but the default is fine
660
+ for most applications. -->
661
+ <!-- <similarity class="org.apache.lucene.search.DefaultSimilarity"/> -->
662
+ <!-- ... OR ...
663
+ Specify a SimilarityFactory class name implementation
664
+ allowing parameters to be used.
665
+ -->
666
+ <!--
667
+ <similarity class="com.example.solr.CustomSimilarityFactory">
668
+ <str name="paramkey">param value</str>
669
+ </similarity>
670
+ -->
671
+
672
+
673
+ </schema>