benjaminkrause-sunspot 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. data/History.txt +107 -0
  2. data/LICENSE +18 -0
  3. data/README.rdoc +159 -0
  4. data/Rakefile +9 -0
  5. data/TODO +11 -0
  6. data/VERSION.yml +4 -0
  7. data/bin/sunspot-configure-solr +46 -0
  8. data/bin/sunspot-solr +86 -0
  9. data/lib/light_config.rb +40 -0
  10. data/lib/sunspot/adapters.rb +265 -0
  11. data/lib/sunspot/composite_setup.rb +184 -0
  12. data/lib/sunspot/configuration.rb +49 -0
  13. data/lib/sunspot/data_extractor.rb +50 -0
  14. data/lib/sunspot/dsl/field_query.rb +77 -0
  15. data/lib/sunspot/dsl/fields.rb +95 -0
  16. data/lib/sunspot/dsl/fulltext.rb +106 -0
  17. data/lib/sunspot/dsl/query.rb +107 -0
  18. data/lib/sunspot/dsl/query_facet.rb +31 -0
  19. data/lib/sunspot/dsl/restriction.rb +25 -0
  20. data/lib/sunspot/dsl/scope.rb +193 -0
  21. data/lib/sunspot/dsl/search.rb +30 -0
  22. data/lib/sunspot/dsl.rb +4 -0
  23. data/lib/sunspot/facet.rb +24 -0
  24. data/lib/sunspot/facet_data.rb +152 -0
  25. data/lib/sunspot/facet_row.rb +12 -0
  26. data/lib/sunspot/field.rb +148 -0
  27. data/lib/sunspot/field_factory.rb +141 -0
  28. data/lib/sunspot/indexer.rb +129 -0
  29. data/lib/sunspot/instantiated_facet.rb +45 -0
  30. data/lib/sunspot/instantiated_facet_row.rb +27 -0
  31. data/lib/sunspot/query/base_query.rb +55 -0
  32. data/lib/sunspot/query/boost_query.rb +20 -0
  33. data/lib/sunspot/query/connective.rb +148 -0
  34. data/lib/sunspot/query/dynamic_query.rb +61 -0
  35. data/lib/sunspot/query/field_facet.rb +129 -0
  36. data/lib/sunspot/query/field_query.rb +69 -0
  37. data/lib/sunspot/query/fulltext_base_query.rb +86 -0
  38. data/lib/sunspot/query/highlighting.rb +36 -0
  39. data/lib/sunspot/query/local.rb +24 -0
  40. data/lib/sunspot/query/pagination.rb +39 -0
  41. data/lib/sunspot/query/query_facet.rb +78 -0
  42. data/lib/sunspot/query/query_facet_row.rb +19 -0
  43. data/lib/sunspot/query/query_field_facet.rb +20 -0
  44. data/lib/sunspot/query/restriction.rb +272 -0
  45. data/lib/sunspot/query/scope.rb +185 -0
  46. data/lib/sunspot/query/sort.rb +105 -0
  47. data/lib/sunspot/query/sort_composite.rb +33 -0
  48. data/lib/sunspot/query/text_field_boost.rb +15 -0
  49. data/lib/sunspot/query.rb +108 -0
  50. data/lib/sunspot/schema.rb +147 -0
  51. data/lib/sunspot/search/highlight.rb +38 -0
  52. data/lib/sunspot/search/hit.rb +113 -0
  53. data/lib/sunspot/search.rb +240 -0
  54. data/lib/sunspot/session.rb +206 -0
  55. data/lib/sunspot/setup.rb +312 -0
  56. data/lib/sunspot/text_field_setup.rb +29 -0
  57. data/lib/sunspot/type.rb +200 -0
  58. data/lib/sunspot/util.rb +190 -0
  59. data/lib/sunspot.rb +459 -0
  60. data/solr/etc/jetty.xml +212 -0
  61. data/solr/etc/webdefault.xml +379 -0
  62. data/solr/lib/jetty-6.1.3.jar +0 -0
  63. data/solr/lib/jetty-util-6.1.3.jar +0 -0
  64. data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
  65. data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
  66. data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
  67. data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
  68. data/solr/lib/servlet-api-2.5-6.1.3.jar +0 -0
  69. data/solr/solr/conf/elevate.xml +36 -0
  70. data/solr/solr/conf/protwords.txt +21 -0
  71. data/solr/solr/conf/schema.xml +64 -0
  72. data/solr/solr/conf/solrconfig.xml +726 -0
  73. data/solr/solr/conf/stopwords.txt +57 -0
  74. data/solr/solr/conf/synonyms.txt +31 -0
  75. data/solr/start.jar +0 -0
  76. data/solr/webapps/solr.war +0 -0
  77. data/spec/api/adapters_spec.rb +33 -0
  78. data/spec/api/indexer/attributes_spec.rb +100 -0
  79. data/spec/api/indexer/batch_spec.rb +46 -0
  80. data/spec/api/indexer/dynamic_fields_spec.rb +33 -0
  81. data/spec/api/indexer/fixed_fields_spec.rb +57 -0
  82. data/spec/api/indexer/fulltext_spec.rb +43 -0
  83. data/spec/api/indexer/removal_spec.rb +46 -0
  84. data/spec/api/indexer/spec_helper.rb +1 -0
  85. data/spec/api/indexer_spec.rb +4 -0
  86. data/spec/api/query/connectives_spec.rb +161 -0
  87. data/spec/api/query/dsl_spec.rb +12 -0
  88. data/spec/api/query/dynamic_fields_spec.rb +148 -0
  89. data/spec/api/query/faceting_spec.rb +272 -0
  90. data/spec/api/query/fulltext_spec.rb +152 -0
  91. data/spec/api/query/highlighting_spec.rb +82 -0
  92. data/spec/api/query/local_spec.rb +37 -0
  93. data/spec/api/query/ordering_pagination_spec.rb +95 -0
  94. data/spec/api/query/scope_spec.rb +253 -0
  95. data/spec/api/query/spec_helper.rb +1 -0
  96. data/spec/api/query/text_field_scoping_spec.rb +30 -0
  97. data/spec/api/query/types_spec.rb +20 -0
  98. data/spec/api/search/dynamic_fields_spec.rb +27 -0
  99. data/spec/api/search/faceting_spec.rb +206 -0
  100. data/spec/api/search/highlighting_spec.rb +65 -0
  101. data/spec/api/search/hits_spec.rb +62 -0
  102. data/spec/api/search/results_spec.rb +52 -0
  103. data/spec/api/search/search_spec.rb +11 -0
  104. data/spec/api/search/spec_helper.rb +1 -0
  105. data/spec/api/session_spec.rb +157 -0
  106. data/spec/api/spec_helper.rb +1 -0
  107. data/spec/api/sunspot_spec.rb +18 -0
  108. data/spec/helpers/indexer_helper.rb +29 -0
  109. data/spec/helpers/query_helper.rb +13 -0
  110. data/spec/helpers/search_helper.rb +78 -0
  111. data/spec/integration/dynamic_fields_spec.rb +55 -0
  112. data/spec/integration/faceting_spec.rb +169 -0
  113. data/spec/integration/highlighting_spec.rb +22 -0
  114. data/spec/integration/keyword_search_spec.rb +148 -0
  115. data/spec/integration/local_search_spec.rb +47 -0
  116. data/spec/integration/scoped_search_spec.rb +303 -0
  117. data/spec/integration/spec_helper.rb +1 -0
  118. data/spec/integration/stored_fields_spec.rb +10 -0
  119. data/spec/integration/test_pagination.rb +32 -0
  120. data/spec/mocks/adapters.rb +32 -0
  121. data/spec/mocks/blog.rb +3 -0
  122. data/spec/mocks/comment.rb +19 -0
  123. data/spec/mocks/connection.rb +84 -0
  124. data/spec/mocks/mock_adapter.rb +30 -0
  125. data/spec/mocks/mock_record.rb +48 -0
  126. data/spec/mocks/photo.rb +8 -0
  127. data/spec/mocks/post.rb +75 -0
  128. data/spec/mocks/super_class.rb +2 -0
  129. data/spec/mocks/user.rb +8 -0
  130. data/spec/spec_helper.rb +60 -0
  131. data/tasks/gemspec.rake +35 -0
  132. data/tasks/rcov.rake +28 -0
  133. data/tasks/rdoc.rake +22 -0
  134. data/tasks/schema.rake +19 -0
  135. data/tasks/spec.rake +24 -0
  136. data/tasks/todo.rake +4 -0
  137. data/templates/schema.xml.erb +36 -0
  138. metadata +312 -0
@@ -0,0 +1,726 @@
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
+ <config>
20
+ <!-- Set this to 'false' if you want solr to continue working after it has
21
+ encountered an severe configuration error. In a production environment,
22
+ you may want solr to keep working even if one handler is mis-configured.
23
+
24
+ You may also set this to false using by setting the system property:
25
+ -Dsolr.abortOnConfigurationError=false
26
+ -->
27
+ <abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
28
+
29
+ <!-- Used to specify an alternate directory to hold all index data
30
+ other than the default ./data under the Solr home.
31
+ If replication is in use, this should match the replication configuration. -->
32
+ <dataDir>${solr.data.dir:./solr/data}</dataDir>
33
+
34
+
35
+ <indexDefaults>
36
+ <!-- Values here affect all index writers and act as a default unless overridden. -->
37
+ %arr{ :name => 'components' }
38
+ %str localsolr
39
+ %str facet
40
+ %str mlt
41
+ %str highlight
42
+ %str debug
43
+ <useCompoundFile>false</useCompoundFile>
44
+
45
+ <mergeFactor>10</mergeFactor>
46
+ <!--
47
+ If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first.
48
+
49
+ -->
50
+ <!--<maxBufferedDocs>1000</maxBufferedDocs>-->
51
+ <!-- Tell Lucene when to flush documents to disk.
52
+ Giving Lucene more memory for indexing means faster indexing at the cost of more RAM
53
+
54
+ If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first.
55
+
56
+ -->
57
+ <ramBufferSizeMB>32</ramBufferSizeMB>
58
+ <maxMergeDocs>2147483647</maxMergeDocs>
59
+ <maxFieldLength>10000</maxFieldLength>
60
+ <writeLockTimeout>1000</writeLockTimeout>
61
+ <commitLockTimeout>10000</commitLockTimeout>
62
+
63
+ <!--
64
+ Expert: Turn on Lucene's auto commit capability.
65
+ This causes intermediate segment flushes to write a new lucene
66
+ index descriptor, enabling it to be opened by an external
67
+ IndexReader.
68
+ NOTE: Despite the name, this value does not have any relation to Solr's autoCommit functionality
69
+ -->
70
+ <!--<luceneAutoCommit>false</luceneAutoCommit>-->
71
+ <!--
72
+ Expert:
73
+ The Merge Policy in Lucene controls how merging is handled by Lucene. The default in 2.3 is the LogByteSizeMergePolicy, previous
74
+ versions used LogDocMergePolicy.
75
+
76
+ LogByteSizeMergePolicy chooses segments to merge based on their size. The Lucene 2.2 default, LogDocMergePolicy chose when
77
+ to merge based on number of documents
78
+
79
+ Other implementations of MergePolicy must have a no-argument constructor
80
+ -->
81
+ <!--<mergePolicy>org.apache.lucene.index.LogByteSizeMergePolicy</mergePolicy>-->
82
+
83
+ <!--
84
+ Expert:
85
+ The Merge Scheduler in Lucene controls how merges are performed. The ConcurrentMergeScheduler (Lucene 2.3 default)
86
+ can perform merges in the background using separate threads. The SerialMergeScheduler (Lucene 2.2 default) does not.
87
+ -->
88
+ <!--<mergeScheduler>org.apache.lucene.index.ConcurrentMergeScheduler</mergeScheduler>-->
89
+
90
+ <!--
91
+ This option specifies which Lucene LockFactory implementation to use.
92
+
93
+ single = SingleInstanceLockFactory - suggested for a read-only index
94
+ or when there is no possibility of another process trying
95
+ to modify the index.
96
+ native = NativeFSLockFactory
97
+ simple = SimpleFSLockFactory
98
+
99
+ (For backwards compatibility with Solr 1.2, 'simple' is the default
100
+ if not specified.)
101
+ -->
102
+ <lockType>single</lockType>
103
+ </indexDefaults>
104
+
105
+ <mainIndex>
106
+ <!-- options specific to the main on-disk lucene index -->
107
+ <useCompoundFile>false</useCompoundFile>
108
+ <ramBufferSizeMB>32</ramBufferSizeMB>
109
+ <mergeFactor>10</mergeFactor>
110
+ <!-- Deprecated -->
111
+ <!--<maxBufferedDocs>1000</maxBufferedDocs>-->
112
+ <maxMergeDocs>2147483647</maxMergeDocs>
113
+ <maxFieldLength>10000</maxFieldLength>
114
+
115
+ <!-- If true, unlock any held write or commit locks on startup.
116
+ This defeats the locking mechanism that allows multiple
117
+ processes to safely access a lucene index, and should be
118
+ used with care.
119
+ This is not needed if lock type is 'none' or 'single'
120
+ -->
121
+ <unlockOnStartup>false</unlockOnStartup>
122
+ </mainIndex>
123
+
124
+ <!-- Enables JMX if and only if an existing MBeanServer is found, use
125
+ this if you want to configure JMX through JVM parameters. Remove
126
+ this to disable exposing Solr configuration and statistics to JMX.
127
+
128
+ If you want to connect to a particular server, specify the agentId
129
+ e.g. <jmx agentId="myAgent" />
130
+
131
+ If you want to start a new MBeanServer, specify the serviceUrl
132
+ e.g <jmx serviceurl="service:jmx:rmi:///jndi/rmi://localhost:9999/solr" />
133
+
134
+ For more details see http://wiki.apache.org/solr/SolrJmx
135
+ -->
136
+ <jmx />
137
+
138
+ <!-- the default high-performance update handler -->
139
+ <updateHandler class="solr.DirectUpdateHandler2">
140
+
141
+ <!-- A prefix of "solr." for class names is an alias that
142
+ causes solr to search appropriate packages, including
143
+ org.apache.solr.(search|update|request|core|analysis)
144
+ -->
145
+
146
+ <!-- Perform a <commit/> automatically under certain conditions:
147
+ maxDocs - number of updates since last commit is greater than this
148
+ maxTime - oldest uncommited update (in ms) is this long ago
149
+ <autoCommit>
150
+ <maxDocs>10000</maxDocs>
151
+ <maxTime>1000</maxTime>
152
+ </autoCommit>
153
+ -->
154
+
155
+ <!-- The RunExecutableListener executes an external command.
156
+ exe - the name of the executable to run
157
+ dir - dir to use as the current working directory. default="."
158
+ wait - the calling thread waits until the executable returns. default="true"
159
+ args - the arguments to pass to the program. default=nothing
160
+ env - environment variables to set. default=nothing
161
+ -->
162
+ <!-- A postCommit event is fired after every commit or optimize command
163
+ <listener event="postCommit" class="solr.RunExecutableListener">
164
+ <str name="exe">solr/bin/snapshooter</str>
165
+ <str name="dir">.</str>
166
+ <bool name="wait">true</bool>
167
+ <arr name="args"> <str>arg1</str> <str>arg2</str> </arr>
168
+ <arr name="env"> <str>MYVAR=val1</str> </arr>
169
+ </listener>
170
+ -->
171
+ <!-- A postOptimize event is fired only after every optimize command, useful
172
+ in conjunction with index distribution to only distribute optimized indicies
173
+ <listener event="postOptimize" class="solr.RunExecutableListener">
174
+ <str name="exe">snapshooter</str>
175
+ <str name="dir">solr/bin</str>
176
+ <bool name="wait">true</bool>
177
+ </listener>
178
+ -->
179
+
180
+ </updateHandler>
181
+
182
+
183
+ <query>
184
+ <!-- Maximum number of clauses in a boolean query... can affect
185
+ range or prefix queries that expand to big boolean
186
+ queries. An exception is thrown if exceeded. -->
187
+ <maxBooleanClauses>1024</maxBooleanClauses>
188
+
189
+
190
+ <!-- Cache used by SolrIndexSearcher for filters (DocSets),
191
+ unordered sets of *all* documents that match a query.
192
+ When a new searcher is opened, its caches may be prepopulated
193
+ or "autowarmed" using data from caches in the old searcher.
194
+ autowarmCount is the number of items to prepopulate. For LRUCache,
195
+ the autowarmed items will be the most recently accessed items.
196
+ Parameters:
197
+ class - the SolrCache implementation (currently only LRUCache)
198
+ size - the maximum number of entries in the cache
199
+ initialSize - the initial capacity (number of entries) of
200
+ the cache. (seel java.util.HashMap)
201
+ autowarmCount - the number of entries to prepopulate from
202
+ and old cache.
203
+ -->
204
+ <filterCache
205
+ class="solr.LRUCache"
206
+ size="512"
207
+ initialSize="512"
208
+ autowarmCount="128"/>
209
+
210
+ <!-- queryResultCache caches results of searches - ordered lists of
211
+ document ids (DocList) based on a query, a sort, and the range
212
+ of documents requested. -->
213
+ <queryResultCache
214
+ class="solr.LRUCache"
215
+ size="512"
216
+ initialSize="512"
217
+ autowarmCount="32"/>
218
+
219
+ <!-- documentCache caches Lucene Document objects (the stored fields for each document).
220
+ Since Lucene internal document ids are transient, this cache will not be autowarmed. -->
221
+ <documentCache
222
+ class="solr.LRUCache"
223
+ size="512"
224
+ initialSize="512"
225
+ autowarmCount="0"/>
226
+
227
+ <!-- If true, stored fields that are not requested will be loaded lazily.
228
+
229
+ This can result in a significant speed improvement if the usual case is to
230
+ not load all stored fields, especially if the skipped fields are large compressed
231
+ text fields.
232
+ -->
233
+ <enableLazyFieldLoading>true</enableLazyFieldLoading>
234
+
235
+ <!-- Example of a generic cache. These caches may be accessed by name
236
+ through SolrIndexSearcher.getCache(),cacheLookup(), and cacheInsert().
237
+ The purpose is to enable easy caching of user/application level data.
238
+ The regenerator argument should be specified as an implementation
239
+ of solr.search.CacheRegenerator if autowarming is desired. -->
240
+ <!--
241
+ <cache name="myUserCache"
242
+ class="solr.LRUCache"
243
+ size="4096"
244
+ initialSize="1024"
245
+ autowarmCount="1024"
246
+ regenerator="org.mycompany.mypackage.MyRegenerator"
247
+ />
248
+ -->
249
+
250
+ <!-- An optimization that attempts to use a filter to satisfy a search.
251
+ If the requested sort does not include score, then the filterCache
252
+ will be checked for a filter matching the query. If found, the filter
253
+ will be used as the source of document ids, and then the sort will be
254
+ applied to that.
255
+ <useFilterForSortedQuery>true</useFilterForSortedQuery>
256
+ -->
257
+
258
+ <!-- An optimization for use with the queryResultCache. When a search
259
+ is requested, a superset of the requested number of document ids
260
+ are collected. For example, if a search for a particular query
261
+ requests matching documents 10 through 19, and queryWindowSize is 50,
262
+ then documents 0 through 49 will be collected and cached. Any further
263
+ requests in that range can be satisfied via the cache. -->
264
+ <queryResultWindowSize>50</queryResultWindowSize>
265
+
266
+ <!-- Maximum number of documents to cache for any entry in the
267
+ queryResultCache. -->
268
+ <queryResultMaxDocsCached>200</queryResultMaxDocsCached>
269
+
270
+ <!-- This entry enables an int hash representation for filters (DocSets)
271
+ when the number of items in the set is less than maxSize. For smaller
272
+ sets, this representation is more memory efficient, more efficient to
273
+ iterate over, and faster to take intersections. -->
274
+ <HashDocSet maxSize="3000" loadFactor="0.75"/>
275
+
276
+ <!-- a newSearcher event is fired whenever a new searcher is being prepared
277
+ and there is a current searcher handling requests (aka registered). -->
278
+ <!-- QuerySenderListener takes an array of NamedList and executes a
279
+ local query request for each NamedList in sequence. -->
280
+ <listener event="newSearcher" class="solr.QuerySenderListener">
281
+ <arr name="queries">
282
+ <lst> <str name="q">solr</str> <str name="start">0</str> <str name="rows">10</str> </lst>
283
+ <lst> <str name="q">rocks</str> <str name="start">0</str> <str name="rows">10</str> </lst>
284
+ <lst><str name="q">static newSearcher warming query from solrconfig.xml</str></lst>
285
+ </arr>
286
+ </listener>
287
+
288
+ <!-- a firstSearcher event is fired whenever a new searcher is being
289
+ prepared but there is no current registered searcher to handle
290
+ requests or to gain autowarming data from. -->
291
+ <listener event="firstSearcher" class="solr.QuerySenderListener">
292
+ <arr name="queries">
293
+ <lst> <str name="q">fast_warm</str> <str name="start">0</str> <str name="rows">10</str> </lst>
294
+ <lst><str name="q">static firstSearcher warming query from solrconfig.xml</str></lst>
295
+ </arr>
296
+ </listener>
297
+
298
+ <!-- If a search request comes in and there is no current registered searcher,
299
+ then immediately register the still warming searcher and use it. If
300
+ "false" then all requests will block until the first searcher is done
301
+ warming. -->
302
+ <useColdSearcher>false</useColdSearcher>
303
+
304
+ <!-- Maximum number of searchers that may be warming in the background
305
+ concurrently. An error is returned if this limit is exceeded. Recommend
306
+ 1-2 for read-only slaves, higher for masters w/o cache warming. -->
307
+ <maxWarmingSearchers>2</maxWarmingSearchers>
308
+
309
+ </query>
310
+
311
+ <!--
312
+ Let the dispatch filter handler /select?qt=XXX
313
+ handleSelect=true will use consistent error handling for /select and /update
314
+ handleSelect=false will use solr1.1 style error formatting
315
+ -->
316
+ <requestDispatcher handleSelect="true" >
317
+ <!--Make sure your system has some authentication before enabling remote streaming! -->
318
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
319
+
320
+ <!-- Set HTTP caching related parameters (for proxy caches and clients).
321
+
322
+ To get the behaviour of Solr 1.2 (ie: no caching related headers)
323
+ use the never304="true" option and do not specify a value for
324
+ <cacheControl>
325
+ -->
326
+ <!-- <httpCaching never304="true"> -->
327
+ <httpCaching lastModifiedFrom="openTime"
328
+ etagSeed="Solr">
329
+ <!-- lastModFrom="openTime" is the default, the Last-Modified value
330
+ (and validation against If-Modified-Since requests) will all be
331
+ relative to when the current Searcher was opened.
332
+ You can change it to lastModFrom="dirLastMod" if you want the
333
+ value to exactly corrispond to when the physical index was last
334
+ modified.
335
+
336
+ etagSeed="..." is an option you can change to force the ETag
337
+ header (and validation against If-None-Match requests) to be
338
+ differnet even if the index has not changed (ie: when making
339
+ significant changes to your config file)
340
+
341
+ lastModifiedFrom and etagSeed are both ignored if you use the
342
+ never304="true" option.
343
+ -->
344
+ <!-- If you include a <cacheControl> directive, it will be used to
345
+ generate a Cache-Control header, as well as an Expires header
346
+ if the value contains "max-age="
347
+
348
+ By default, no Cache-Control header is generated.
349
+
350
+ You can use the <cacheControl> option even if you have set
351
+ never304="true"
352
+ -->
353
+ <!-- <cacheControl>max-age=30, public</cacheControl> -->
354
+ </httpCaching>
355
+ </requestDispatcher>
356
+
357
+
358
+ <!-- requestHandler plugins... incoming queries will be dispatched to the
359
+ correct handler based on the path or the qt (query type) param.
360
+ Names starting with a '/' are accessed with the a path equal to the
361
+ registered name. Names without a leading '/' are accessed with:
362
+ http://host/app/select?qt=name
363
+ If no qt is defined, the requestHandler that declares default="true"
364
+ will be used.
365
+ -->
366
+ <requestHandler name="standard" class="solr.SearchHandler" default="true">
367
+ <!-- default values for query parameters -->
368
+ <lst name="defaults">
369
+ <str name="echoParams">explicit</str>
370
+ <!--
371
+ <int name="rows">10</int>
372
+ <str name="fl">*</str>
373
+ <str name="version">2.1</str>
374
+ -->
375
+ </lst>
376
+ </requestHandler>
377
+
378
+
379
+ <!-- DisMaxRequestHandler allows easy searching across multiple fields
380
+ for simple user-entered phrases. It's implementation is now
381
+ just the standard SearchHandler with a default query type
382
+ of "dismax".
383
+ see http://wiki.apache.org/solr/DisMaxRequestHandler
384
+ -->
385
+ <requestHandler name="dismax" class="solr.SearchHandler" >
386
+ <lst name="defaults">
387
+ <str name="defType">dismax</str>
388
+ <str name="echoParams">explicit</str>
389
+ <float name="tie">0.01</float>
390
+ <str name="qf">
391
+ text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
392
+ </str>
393
+ <str name="pf">
394
+ text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9
395
+ </str>
396
+ <str name="bf">
397
+ ord(popularity)^0.5 recip(rord(price),1,1000,1000)^0.3
398
+ </str>
399
+ <str name="fl">
400
+ id,name,price,score
401
+ </str>
402
+ <str name="mm">
403
+ 2&lt;-1 5&lt;-2 6&lt;90%
404
+ </str>
405
+ <int name="ps">100</int>
406
+ <str name="q.alt">*:*</str>
407
+ <!-- example highlighter config, enable per-query with hl=true -->
408
+ <str name="hl.fl">text features name</str>
409
+ <!-- for this field, we want no fragmenting, just highlighting -->
410
+ <str name="f.name.hl.fragsize">0</str>
411
+ <!-- instructs Solr to return the field itself if no query terms are
412
+ found -->
413
+ <str name="f.name.hl.alternateField">name</str>
414
+ <str name="f.text.hl.fragmenter">regex</str> <!-- defined below -->
415
+ </lst>
416
+ </requestHandler>
417
+
418
+ <!-- Note how you can register the same handler multiple times with
419
+ different names (and different init parameters)
420
+ -->
421
+ <requestHandler name="partitioned" class="solr.SearchHandler" >
422
+ <lst name="defaults">
423
+ <str name="defType">dismax</str>
424
+ <str name="echoParams">explicit</str>
425
+ <str name="qf">text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0</str>
426
+ <str name="mm">2&lt;-1 5&lt;-2 6&lt;90%</str>
427
+ <!-- This is an example of using Date Math to specify a constantly
428
+ moving date range in a config...
429
+ -->
430
+ <str name="bq">incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2</str>
431
+ </lst>
432
+ <!-- In addition to defaults, "appends" params can be specified
433
+ to identify values which should be appended to the list of
434
+ multi-val params from the query (or the existing "defaults").
435
+
436
+ In this example, the param "fq=instock:true" will be appended to
437
+ any query time fq params the user may specify, as a mechanism for
438
+ partitioning the index, independent of any user selected filtering
439
+ that may also be desired (perhaps as a result of faceted searching).
440
+
441
+ NOTE: there is *absolutely* nothing a client can do to prevent these
442
+ "appends" values from being used, so don't use this mechanism
443
+ unless you are sure you always want it.
444
+ -->
445
+ <lst name="appends">
446
+ <str name="fq">inStock:true</str>
447
+ </lst>
448
+ <!-- "invariants" are a way of letting the Solr maintainer lock down
449
+ the options available to Solr clients. Any params values
450
+ specified here are used regardless of what values may be specified
451
+ in either the query, the "defaults", or the "appends" params.
452
+
453
+ In this example, the facet.field and facet.query params are fixed,
454
+ limiting the facets clients can use. Faceting is not turned on by
455
+ default - but if the client does specify facet=true in the request,
456
+ these are the only facets they will be able to see counts for;
457
+ regardless of what other facet.field or facet.query params they
458
+ may specify.
459
+
460
+ NOTE: there is *absolutely* nothing a client can do to prevent these
461
+ "invariants" values from being used, so don't use this mechanism
462
+ unless you are sure you always want it.
463
+ -->
464
+ <lst name="invariants">
465
+ <str name="facet.field">cat</str>
466
+ <str name="facet.field">manu_exact</str>
467
+ <str name="facet.query">price:[* TO 500]</str>
468
+ <str name="facet.query">price:[500 TO *]</str>
469
+ </lst>
470
+ </requestHandler>
471
+
472
+
473
+ <!--
474
+ Search components are registered to SolrCore and used by Search Handlers
475
+
476
+ By default, the following components are avaliable:
477
+
478
+ <searchComponent name="query" class="org.apache.solr.handler.component.QueryComponent" />
479
+ <searchComponent name="facet" class="org.apache.solr.handler.component.FacetComponent" />
480
+ <searchComponent name="mlt" class="org.apache.solr.handler.component.MoreLikeThisComponent" />
481
+ <searchComponent name="highlight" class="org.apache.solr.handler.component.HighlightComponent" />
482
+ <searchComponent name="debug" class="org.apache.solr.handler.component.DebugComponent" />
483
+
484
+ Default configuration in a requestHandler would look like:
485
+ <arr name="components">
486
+ <str>query</str>
487
+ <str>facet</str>
488
+ <str>mlt</str>
489
+ <str>highlight</str>
490
+ <str>debug</str>
491
+ </arr>
492
+
493
+ If you register a searchComponent to one of the standard names, that will be used instead.
494
+ To insert handlers before or after the 'standard' components, use:
495
+
496
+ <arr name="first-components">
497
+ <str>myFirstComponentName</str>
498
+ </arr>
499
+
500
+ <arr name="last-components">
501
+ <str>myLastComponentName</str>
502
+ </arr>
503
+ -->
504
+
505
+ <!-- The spell check component can return a list of alternative spelling
506
+ suggestions. -->
507
+ <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
508
+
509
+ <str name="queryAnalyzerFieldType">textSpell</str>
510
+
511
+ <lst name="spellchecker">
512
+ <str name="name">default</str>
513
+ <str name="field">spell</str>
514
+ <str name="spellcheckIndexDir">./spellchecker1</str>
515
+
516
+ </lst>
517
+ <lst name="spellchecker">
518
+ <str name="name">jarowinkler</str>
519
+ <str name="field">spell</str>
520
+ <!-- Use a different Distance Measure -->
521
+ <str name="distanceMeasure">org.apache.lucene.search.spell.JaroWinklerDistance</str>
522
+ <str name="spellcheckIndexDir">./spellchecker2</str>
523
+
524
+ </lst>
525
+
526
+ <lst name="spellchecker">
527
+ <str name="classname">solr.FileBasedSpellChecker</str>
528
+ <str name="name">file</str>
529
+ <str name="sourceLocation">spellings.txt</str>
530
+ <str name="characterEncoding">UTF-8</str>
531
+ <str name="spellcheckIndexDir">./spellcheckerFile</str>
532
+ </lst>
533
+ </searchComponent>
534
+
535
+ <!-- a request handler utilizing the spellcheck component -->
536
+ <requestHandler name="/spellCheckCompRH" class="solr.SearchHandler">
537
+ <lst name="defaults">
538
+ <!-- omp = Only More Popular -->
539
+ <str name="spellcheck.onlyMorePopular">false</str>
540
+ <!-- exr = Extended Results -->
541
+ <str name="spellcheck.extendedResults">false</str>
542
+ <!-- The number of suggestions to return -->
543
+ <str name="spellcheck.count">1</str>
544
+ </lst>
545
+ <arr name="last-components">
546
+ <str>spellcheck</str>
547
+ </arr>
548
+ </requestHandler>
549
+
550
+ <!-- a search component that enables you to configure the top results for
551
+ a given query regardless of the normal lucene scoring.-->
552
+ <searchComponent name="elevator" class="solr.QueryElevationComponent" >
553
+ <!-- pick a fieldType to analyze queries -->
554
+ <str name="queryFieldType">string</str>
555
+ <str name="config-file">elevate.xml</str>
556
+ </searchComponent>
557
+
558
+ <!-- a request handler utilizing the elevator component -->
559
+ <requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">
560
+ <lst name="defaults">
561
+ <str name="echoParams">explicit</str>
562
+ </lst>
563
+ <arr name="last-components">
564
+ <str>elevator</str>
565
+ </arr>
566
+ </requestHandler>
567
+
568
+
569
+ <!-- Update request handler.
570
+
571
+ Note: Since solr1.1 requestHandlers requires a valid content type header if posted in
572
+ the body. For example, curl now requires: -H 'Content-type:text/xml; charset=utf-8'
573
+ The response format differs from solr1.1 formatting and returns a standard error code.
574
+
575
+ To enable solr1.1 behavior, remove the /update handler or change its path
576
+ -->
577
+ <requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />
578
+
579
+ <!--
580
+ Analysis request handler. Since Solr 1.3. Use to returnhow a document is analyzed. Useful
581
+ for debugging and as a token server for other types of applications
582
+ -->
583
+ <requestHandler name="/analysis" class="solr.AnalysisRequestHandler" />
584
+
585
+
586
+ <!-- CSV update handler, loaded on demand -->
587
+ <requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy" />
588
+
589
+
590
+ <!--
591
+ Admin Handlers - This will register all the standard admin RequestHandlers. Adding
592
+ this single handler is equivolent to registering:
593
+
594
+ <requestHandler name="/admin/luke" class="org.apache.solr.handler.admin.LukeRequestHandler" />
595
+ <requestHandler name="/admin/system" class="org.apache.solr.handler.admin.SystemInfoHandler" />
596
+ <requestHandler name="/admin/plugins" class="org.apache.solr.handler.admin.PluginInfoHandler" />
597
+ <requestHandler name="/admin/threads" class="org.apache.solr.handler.admin.ThreadDumpHandler" />
598
+ <requestHandler name="/admin/properties" class="org.apache.solr.handler.admin.PropertiesRequestHandler" />
599
+ <requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" >
600
+
601
+ If you wish to hide files under ${solr.home}/conf, explicitly register the ShowFileRequestHandler using:
602
+ <requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" >
603
+ <lst name="invariants">
604
+ <str name="hidden">synonyms.txt</str>
605
+ <str name="hidden">anotherfile.txt</str>
606
+ </lst>
607
+ </requestHandler>
608
+ -->
609
+ <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
610
+
611
+ <!-- ping/healthcheck -->
612
+ <requestHandler name="/admin/ping" class="PingRequestHandler">
613
+ <lst name="defaults">
614
+ <str name="qt">standard</str>
615
+ <str name="q">solrpingquery</str>
616
+ <str name="echoParams">all</str>
617
+ </lst>
618
+ </requestHandler>
619
+
620
+ <!-- Echo the request contents back to the client -->
621
+ <requestHandler name="/debug/dump" class="solr.DumpRequestHandler" >
622
+ <lst name="defaults">
623
+ <str name="echoParams">explicit</str> <!-- for all params (including the default etc) use: 'all' -->
624
+ <str name="echoHandler">true</str>
625
+ </lst>
626
+ </requestHandler>
627
+
628
+ <highlighting>
629
+ <!-- Configure the standard fragmenter -->
630
+ <!-- This could most likely be commented out in the "default" case -->
631
+ <fragmenter name="gap" class="org.apache.solr.highlight.GapFragmenter" default="true">
632
+ <lst name="defaults">
633
+ <int name="hl.fragsize">100</int>
634
+ </lst>
635
+ </fragmenter>
636
+
637
+ <!-- A regular-expression-based fragmenter (f.i., for sentence extraction) -->
638
+ <fragmenter name="regex" class="org.apache.solr.highlight.RegexFragmenter">
639
+ <lst name="defaults">
640
+ <!-- slightly smaller fragsizes work better because of slop -->
641
+ <int name="hl.fragsize">70</int>
642
+ <!-- allow 50% slop on fragment sizes -->
643
+ <float name="hl.regex.slop">0.5</float>
644
+ <!-- a basic sentence pattern -->
645
+ <str name="hl.regex.pattern">[-\w ,/\n\"']{20,200}</str>
646
+ </lst>
647
+ </fragmenter>
648
+
649
+ <!-- Configure the standard formatter -->
650
+ <formatter name="html" class="org.apache.solr.highlight.HtmlFormatter" default="true">
651
+ <lst name="defaults">
652
+ <str name="hl.simple.pre"><![CDATA[<em>]]></str>
653
+ <str name="hl.simple.post"><![CDATA[</em>]]></str>
654
+ </lst>
655
+ </formatter>
656
+ </highlighting>
657
+
658
+
659
+ <!-- queryResponseWriter plugins... query responses will be written using the
660
+ writer specified by the 'wt' request parameter matching the name of a registered
661
+ writer.
662
+ The "default" writer is the default and will be used if 'wt' is not specified
663
+ in the request. XMLResponseWriter will be used if nothing is specified here.
664
+ The json, python, and ruby writers are also available by default.
665
+
666
+ <queryResponseWriter name="xml" class="org.apache.solr.request.XMLResponseWriter" default="true"/>
667
+ <queryResponseWriter name="json" class="org.apache.solr.request.JSONResponseWriter"/>
668
+ <queryResponseWriter name="python" class="org.apache.solr.request.PythonResponseWriter"/>
669
+ <queryResponseWriter name="ruby" class="org.apache.solr.request.RubyResponseWriter"/>
670
+ <queryResponseWriter name="php" class="org.apache.solr.request.PHPResponseWriter"/>
671
+ <queryResponseWriter name="phps" class="org.apache.solr.request.PHPSerializedResponseWriter"/>
672
+
673
+ <queryResponseWriter name="custom" class="com.example.MyResponseWriter"/>
674
+ -->
675
+
676
+ <!-- XSLT response writer transforms the XML output by any xslt file found
677
+ in Solr's conf/xslt directory. Changes to xslt files are checked for
678
+ every xsltCacheLifetimeSeconds.
679
+ -->
680
+ <queryResponseWriter name="xslt" class="org.apache.solr.request.XSLTResponseWriter">
681
+ <int name="xsltCacheLifetimeSeconds">5</int>
682
+ </queryResponseWriter>
683
+
684
+
685
+ <!-- example of registering a query parser
686
+ <queryParser name="lucene" class="org.apache.solr.search.LuceneQParserPlugin"/>
687
+ -->
688
+
689
+ <!-- example of registering a custom function parser
690
+ <valueSourceParser name="myfunc" class="com.mycompany.MyValueSourceParser" />
691
+ -->
692
+
693
+ <!-- config for the admin interface -->
694
+ <admin>
695
+ <defaultQuery>solr</defaultQuery>
696
+
697
+ <!-- configure a healthcheck file for servers behind a loadbalancer
698
+ <healthcheck type="file">server-enabled</healthcheck>
699
+ -->
700
+ </admin>
701
+
702
+ <!-- configuration for LocalSolr -->
703
+ <updateRequestProcessorChain>
704
+ <processor class='com.pjaol.search.solr.update.LocalUpdateProcessorFactory'>
705
+ <str name='latField'>lat</str>
706
+ <str name='lngField'>long</str>
707
+ <int name='startTier'>9</int>
708
+ <int name='endTier'>16</int>
709
+ </processor>
710
+ <processor class='solr.RunUpdateProcessorFactory'></processor>
711
+ <processor class='solr.LogUpdateProcessorFactory'></processor>
712
+ </updateRequestProcessorChain>
713
+ <searchComponent class='com.pjaol.search.solr.component.LocalSolrQueryComponent' name='localsolr'>
714
+ <str name='latField'>lat</str>
715
+ <str name='lngField'>long</str>
716
+ </searchComponent>
717
+ <requestHandler class='org.apache.solr.handler.component.SearchHandler' name='geo'>
718
+ <arr name='components'>
719
+ <str>localsolr</str>
720
+ <str>facet</str>
721
+ <str>mlt</str>
722
+ <str>highlight</str>
723
+ <str>debug</str>
724
+ </arr>
725
+ </requestHandler>
726
+ </config>