honkster-acts_as_solr 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. data/CHANGE_LOG +233 -0
  2. data/LICENSE +19 -0
  3. data/README.markdown +118 -0
  4. data/README.rdoc +107 -0
  5. data/Rakefile +68 -0
  6. data/TESTING_THE_PLUGIN +25 -0
  7. data/VERSION +1 -0
  8. data/lib/acts_as_solr/acts_methods.rb +279 -0
  9. data/lib/acts_as_solr/class_methods.rb +236 -0
  10. data/lib/acts_as_solr/common_methods.rb +89 -0
  11. data/lib/acts_as_solr/deprecation.rb +61 -0
  12. data/lib/acts_as_solr/instance_methods.rb +166 -0
  13. data/lib/acts_as_solr/lazy_document.rb +18 -0
  14. data/lib/acts_as_solr/parser_methods.rb +201 -0
  15. data/lib/acts_as_solr/search_results.rb +68 -0
  16. data/lib/acts_as_solr/solr_fixtures.rb +13 -0
  17. data/lib/acts_as_solr/tasks/database.rake +16 -0
  18. data/lib/acts_as_solr/tasks/solr.rake +132 -0
  19. data/lib/acts_as_solr/tasks/test.rake +5 -0
  20. data/lib/acts_as_solr/tasks.rb +10 -0
  21. data/lib/acts_as_solr.rb +64 -0
  22. data/lib/solr/connection.rb +177 -0
  23. data/lib/solr/document.rb +75 -0
  24. data/lib/solr/exception.rb +13 -0
  25. data/lib/solr/field.rb +36 -0
  26. data/lib/solr/importer/array_mapper.rb +26 -0
  27. data/lib/solr/importer/delimited_file_source.rb +38 -0
  28. data/lib/solr/importer/hpricot_mapper.rb +27 -0
  29. data/lib/solr/importer/mapper.rb +51 -0
  30. data/lib/solr/importer/solr_source.rb +41 -0
  31. data/lib/solr/importer/xpath_mapper.rb +35 -0
  32. data/lib/solr/importer.rb +19 -0
  33. data/lib/solr/indexer.rb +52 -0
  34. data/lib/solr/request/add_document.rb +58 -0
  35. data/lib/solr/request/base.rb +36 -0
  36. data/lib/solr/request/commit.rb +29 -0
  37. data/lib/solr/request/delete.rb +48 -0
  38. data/lib/solr/request/dismax.rb +46 -0
  39. data/lib/solr/request/index_info.rb +22 -0
  40. data/lib/solr/request/modify_document.rb +46 -0
  41. data/lib/solr/request/optimize.rb +19 -0
  42. data/lib/solr/request/ping.rb +36 -0
  43. data/lib/solr/request/select.rb +54 -0
  44. data/lib/solr/request/spellcheck.rb +30 -0
  45. data/lib/solr/request/standard.rb +402 -0
  46. data/lib/solr/request/update.rb +23 -0
  47. data/lib/solr/request.rb +26 -0
  48. data/lib/solr/response/add_document.rb +17 -0
  49. data/lib/solr/response/base.rb +42 -0
  50. data/lib/solr/response/commit.rb +15 -0
  51. data/lib/solr/response/delete.rb +13 -0
  52. data/lib/solr/response/dismax.rb +8 -0
  53. data/lib/solr/response/index_info.rb +26 -0
  54. data/lib/solr/response/modify_document.rb +17 -0
  55. data/lib/solr/response/optimize.rb +14 -0
  56. data/lib/solr/response/ping.rb +26 -0
  57. data/lib/solr/response/ruby.rb +42 -0
  58. data/lib/solr/response/select.rb +17 -0
  59. data/lib/solr/response/spellcheck.rb +20 -0
  60. data/lib/solr/response/standard.rb +60 -0
  61. data/lib/solr/response/xml.rb +39 -0
  62. data/lib/solr/response.rb +27 -0
  63. data/lib/solr/solrtasks.rb +27 -0
  64. data/lib/solr/util.rb +32 -0
  65. data/lib/solr/xml.rb +44 -0
  66. data/lib/solr.rb +26 -0
  67. data/solr/CHANGES.txt +1207 -0
  68. data/solr/LICENSE.txt +712 -0
  69. data/solr/NOTICE.txt +90 -0
  70. data/solr/etc/jetty.xml +205 -0
  71. data/solr/etc/webdefault.xml +379 -0
  72. data/solr/lib/easymock.jar +0 -0
  73. data/solr/lib/jetty-6.1.3.jar +0 -0
  74. data/solr/lib/jetty-util-6.1.3.jar +0 -0
  75. data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
  76. data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
  77. data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
  78. data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
  79. data/solr/lib/servlet-api-2.4.jar +0 -0
  80. data/solr/lib/servlet-api-2.5-6.1.3.jar +0 -0
  81. data/solr/lib/xpp3-1.1.3.4.O.jar +0 -0
  82. data/solr/solr/README.txt +52 -0
  83. data/solr/solr/bin/abc +176 -0
  84. data/solr/solr/bin/abo +176 -0
  85. data/solr/solr/bin/backup +108 -0
  86. data/solr/solr/bin/backupcleaner +142 -0
  87. data/solr/solr/bin/commit +128 -0
  88. data/solr/solr/bin/optimize +129 -0
  89. data/solr/solr/bin/readercycle +129 -0
  90. data/solr/solr/bin/rsyncd-disable +77 -0
  91. data/solr/solr/bin/rsyncd-enable +76 -0
  92. data/solr/solr/bin/rsyncd-start +145 -0
  93. data/solr/solr/bin/rsyncd-stop +105 -0
  94. data/solr/solr/bin/scripts-util +83 -0
  95. data/solr/solr/bin/snapcleaner +148 -0
  96. data/solr/solr/bin/snapinstaller +168 -0
  97. data/solr/solr/bin/snappuller +248 -0
  98. data/solr/solr/bin/snappuller-disable +77 -0
  99. data/solr/solr/bin/snappuller-enable +77 -0
  100. data/solr/solr/bin/snapshooter +109 -0
  101. data/solr/solr/conf/admin-extra.html +31 -0
  102. data/solr/solr/conf/protwords.txt +21 -0
  103. data/solr/solr/conf/schema.xml +126 -0
  104. data/solr/solr/conf/scripts.conf +24 -0
  105. data/solr/solr/conf/solrconfig.xml +458 -0
  106. data/solr/solr/conf/stopwords.txt +57 -0
  107. data/solr/solr/conf/synonyms.txt +31 -0
  108. data/solr/solr/conf/xslt/example.xsl +132 -0
  109. data/solr/solr/conf/xslt/example_atom.xsl +63 -0
  110. data/solr/solr/conf/xslt/example_rss.xsl +62 -0
  111. data/solr/start.jar +0 -0
  112. data/solr/webapps/solr.war +0 -0
  113. data/test/config/solr.yml +2 -0
  114. data/test/db/connections/mysql/connection.rb +10 -0
  115. data/test/db/connections/sqlite/connection.rb +8 -0
  116. data/test/db/migrate/001_create_books.rb +15 -0
  117. data/test/db/migrate/002_create_movies.rb +12 -0
  118. data/test/db/migrate/003_create_categories.rb +11 -0
  119. data/test/db/migrate/004_create_electronics.rb +16 -0
  120. data/test/db/migrate/005_create_authors.rb +12 -0
  121. data/test/db/migrate/006_create_postings.rb +9 -0
  122. data/test/db/migrate/007_create_posts.rb +13 -0
  123. data/test/db/migrate/008_create_gadgets.rb +11 -0
  124. data/test/fixtures/authors.yml +9 -0
  125. data/test/fixtures/books.yml +13 -0
  126. data/test/fixtures/categories.yml +7 -0
  127. data/test/fixtures/db_definitions/mysql.sql +41 -0
  128. data/test/fixtures/electronics.yml +49 -0
  129. data/test/fixtures/movies.yml +9 -0
  130. data/test/fixtures/postings.yml +10 -0
  131. data/test/functional/acts_as_solr_test.rb +413 -0
  132. data/test/functional/association_indexing_test.rb +37 -0
  133. data/test/functional/faceted_search_test.rb +163 -0
  134. data/test/functional/multi_solr_search_test.rb +51 -0
  135. data/test/models/author.rb +10 -0
  136. data/test/models/book.rb +10 -0
  137. data/test/models/category.rb +8 -0
  138. data/test/models/electronic.rb +21 -0
  139. data/test/models/gadget.rb +9 -0
  140. data/test/models/movie.rb +17 -0
  141. data/test/models/novel.rb +2 -0
  142. data/test/models/post.rb +3 -0
  143. data/test/models/posting.rb +11 -0
  144. data/test/test_helper.rb +51 -0
  145. data/test/unit/acts_methods_shoulda.rb +68 -0
  146. data/test/unit/class_methods_shoulda.rb +85 -0
  147. data/test/unit/common_methods_shoulda.rb +111 -0
  148. data/test/unit/instance_methods_shoulda.rb +318 -0
  149. data/test/unit/lazy_document_shoulda.rb +34 -0
  150. data/test/unit/parser_instance.rb +19 -0
  151. data/test/unit/parser_methods_shoulda.rb +268 -0
  152. data/test/unit/solr_instance.rb +44 -0
  153. data/test/unit/test_helper.rb +22 -0
  154. metadata +239 -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,458 @@
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
+
33
+ <dataDir>${solr.data.dir:./solr/data}</dataDir>
34
+
35
+ <indexDefaults>
36
+ <!-- Values here affect all index writers and act as a default unless overridden. -->
37
+ <useCompoundFile>false</useCompoundFile>
38
+ <mergeFactor>10</mergeFactor>
39
+ <maxBufferedDocs>1000</maxBufferedDocs>
40
+ <maxMergeDocs>2147483647</maxMergeDocs>
41
+ <maxFieldLength>10000</maxFieldLength>
42
+ <writeLockTimeout>1000</writeLockTimeout>
43
+ <commitLockTimeout>10000</commitLockTimeout>
44
+ </indexDefaults>
45
+
46
+ <mainIndex>
47
+ <!-- options specific to the main on-disk lucene index -->
48
+ <useCompoundFile>false</useCompoundFile>
49
+ <mergeFactor>10</mergeFactor>
50
+ <maxBufferedDocs>1000</maxBufferedDocs>
51
+ <maxMergeDocs>2147483647</maxMergeDocs>
52
+ <maxFieldLength>10000</maxFieldLength>
53
+
54
+ <!-- If true, unlock any held write or commit locks on startup.
55
+ This defeats the locking mechanism that allows multiple
56
+ processes to safely access a lucene index, and should be
57
+ used with care. -->
58
+ <unlockOnStartup>false</unlockOnStartup>
59
+ </mainIndex>
60
+
61
+ <!-- the default high-performance update handler -->
62
+ <updateHandler class="solr.DirectUpdateHandler2">
63
+
64
+ <!-- A prefix of "solr." for class names is an alias that
65
+ causes solr to search appropriate packages, including
66
+ org.apache.solr.(search|update|request|core|analysis)
67
+ -->
68
+
69
+ <!-- autocommit pending docs if certain criteria are met
70
+ <autoCommit>
71
+ <maxDocs>10000</maxDocs>
72
+ <maxTime>1000</maxTime>
73
+ </autoCommit>
74
+ -->
75
+
76
+ <!-- The RunExecutableListener executes an external command.
77
+ exe - the name of the executable to run
78
+ dir - dir to use as the current working directory. default="."
79
+ wait - the calling thread waits until the executable returns. default="true"
80
+ args - the arguments to pass to the program. default=nothing
81
+ env - environment variables to set. default=nothing
82
+ -->
83
+ <!-- A postCommit event is fired after every commit or optimize command
84
+ <listener event="postCommit" class="solr.RunExecutableListener">
85
+ <str name="exe">snapshooter</str>
86
+ <str name="dir">solr/bin</str>
87
+ <bool name="wait">true</bool>
88
+ <arr name="args"> <str>arg1</str> <str>arg2</str> </arr>
89
+ <arr name="env"> <str>MYVAR=val1</str> </arr>
90
+ </listener>
91
+ -->
92
+ <!-- A postOptimize event is fired only after every optimize command, useful
93
+ in conjunction with index distribution to only distribute optimized indicies
94
+ <listener event="postOptimize" class="solr.RunExecutableListener">
95
+ <str name="exe">snapshooter</str>
96
+ <str name="dir">solr/bin</str>
97
+ <bool name="wait">true</bool>
98
+ </listener>
99
+ -->
100
+
101
+ </updateHandler>
102
+
103
+
104
+ <query>
105
+ <!-- Maximum number of clauses in a boolean query... can affect
106
+ range or prefix queries that expand to big boolean
107
+ queries. An exception is thrown if exceeded. -->
108
+ <maxBooleanClauses>1024</maxBooleanClauses>
109
+
110
+
111
+ <!-- Cache used by SolrIndexSearcher for filters (DocSets),
112
+ unordered sets of *all* documents that match a query.
113
+ When a new searcher is opened, its caches may be prepopulated
114
+ or "autowarmed" using data from caches in the old searcher.
115
+ autowarmCount is the number of items to prepopulate. For LRUCache,
116
+ the autowarmed items will be the most recently accessed items.
117
+ Parameters:
118
+ class - the SolrCache implementation (currently only LRUCache)
119
+ size - the maximum number of entries in the cache
120
+ initialSize - the initial capacity (number of entries) of
121
+ the cache. (seel java.util.HashMap)
122
+ autowarmCount - the number of entries to prepopulate from
123
+ and old cache.
124
+ -->
125
+ <filterCache
126
+ class="solr.LRUCache"
127
+ size="512"
128
+ initialSize="512"
129
+ autowarmCount="256"/>
130
+
131
+ <!-- queryResultCache caches results of searches - ordered lists of
132
+ document ids (DocList) based on a query, a sort, and the range
133
+ of documents requested. -->
134
+ <queryResultCache
135
+ class="solr.LRUCache"
136
+ size="512"
137
+ initialSize="512"
138
+ autowarmCount="256"/>
139
+
140
+ <!-- documentCache caches Lucene Document objects (the stored fields for each document).
141
+ Since Lucene internal document ids are transient, this cache will not be autowarmed. -->
142
+ <documentCache
143
+ class="solr.LRUCache"
144
+ size="512"
145
+ initialSize="512"
146
+ autowarmCount="0"/>
147
+
148
+ <!-- If true, stored fields that are not requested will be loaded lazily.
149
+
150
+ This can result in a significant speed improvement if the usual case is to
151
+ not load all stored fields, especially if the skipped fields are large compressed
152
+ text fields.
153
+ -->
154
+ <enableLazyFieldLoading>true</enableLazyFieldLoading>
155
+
156
+ <!-- Example of a generic cache. These caches may be accessed by name
157
+ through SolrIndexSearcher.getCache(),cacheLookup(), and cacheInsert().
158
+ The purpose is to enable easy caching of user/application level data.
159
+ The regenerator argument should be specified as an implementation
160
+ of solr.search.CacheRegenerator if autowarming is desired. -->
161
+ <!--
162
+ <cache name="myUserCache"
163
+ class="solr.LRUCache"
164
+ size="4096"
165
+ initialSize="1024"
166
+ autowarmCount="1024"
167
+ regenerator="org.mycompany.mypackage.MyRegenerator"
168
+ />
169
+ -->
170
+
171
+ <!-- An optimization that attempts to use a filter to satisfy a search.
172
+ If the requested sort does not include score, then the filterCache
173
+ will be checked for a filter matching the query. If found, the filter
174
+ will be used as the source of document ids, and then the sort will be
175
+ applied to that.
176
+ <useFilterForSortedQuery>true</useFilterForSortedQuery>
177
+ -->
178
+
179
+ <!-- An optimization for use with the queryResultCache. When a search
180
+ is requested, a superset of the requested number of document ids
181
+ are collected. For example, if a search for a particular query
182
+ requests matching documents 10 through 19, and queryWindowSize is 50,
183
+ then documents 0 through 50 will be collected and cached. Any further
184
+ requests in that range can be satisfied via the cache. -->
185
+ <queryResultWindowSize>10</queryResultWindowSize>
186
+
187
+ <!-- This entry enables an int hash representation for filters (DocSets)
188
+ when the number of items in the set is less than maxSize. For smaller
189
+ sets, this representation is more memory efficient, more efficient to
190
+ iterate over, and faster to take intersections. -->
191
+ <HashDocSet maxSize="3000" loadFactor="0.75"/>
192
+
193
+
194
+ <!-- boolToFilterOptimizer converts boolean clauses with zero boost
195
+ into cached filters if the number of docs selected by the clause exceeds
196
+ the threshold (represented as a fraction of the total index) -->
197
+ <boolTofilterOptimizer enabled="true" cacheSize="32" threshold=".05"/>
198
+
199
+
200
+ <!-- a newSearcher event is fired whenever a new searcher is being prepared
201
+ and there is a current searcher handling requests (aka registered). -->
202
+ <!-- QuerySenderListener takes an array of NamedList and executes a
203
+ local query request for each NamedList in sequence. -->
204
+ <!--
205
+ <listener event="newSearcher" class="solr.QuerySenderListener">
206
+ <arr name="queries">
207
+ <lst> <str name="q">solr</str> <str name="start">0</str> <str name="rows">10</str> </lst>
208
+ <lst> <str name="q">rocks</str> <str name="start">0</str> <str name="rows">10</str> </lst>
209
+ </arr>
210
+ </listener>
211
+ -->
212
+
213
+ <!-- a firstSearcher event is fired whenever a new searcher is being
214
+ prepared but there is no current registered searcher to handle
215
+ requests or to gain autowarming data from. -->
216
+ <!--
217
+ <listener event="firstSearcher" class="solr.QuerySenderListener">
218
+ <arr name="queries">
219
+ <lst> <str name="q">fast_warm</str> <str name="start">0</str> <str name="rows">10</str> </lst>
220
+ </arr>
221
+ </listener>
222
+ -->
223
+
224
+ <!-- If a search request comes in and there is no current registered searcher,
225
+ then immediately register the still warming searcher and use it. If
226
+ "false" then all requests will block until the first searcher is done
227
+ warming. -->
228
+ <useColdSearcher>false</useColdSearcher>
229
+
230
+ <!-- Maximum number of searchers that may be warming in the background
231
+ concurrently. An error is returned if this limit is exceeded. Recommend
232
+ 1-2 for read-only slaves, higher for masters w/o cache warming. -->
233
+ <maxWarmingSearchers>4</maxWarmingSearchers>
234
+
235
+ </query>
236
+
237
+ <!--
238
+ Let the dispatch filter handler /select?qt=XXX
239
+ handleSelect=true will use consistent error handling for /select and /update
240
+ handleSelect=false will use solr1.1 style error formatting
241
+ -->
242
+ <requestDispatcher handleSelect="true" >
243
+ <!--Make sure your system has some authentication before enabling remote streaming! -->
244
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
245
+ </requestDispatcher>
246
+
247
+
248
+ <!-- requestHandler plugins... incoming queries will be dispatched to the
249
+ correct handler based on the qt (query type) param matching the
250
+ name of registered handlers.
251
+ The "standard" request handler is the default and will be used if qt
252
+ is not specified in the request.
253
+ -->
254
+ <requestHandler name="standard" class="solr.StandardRequestHandler">
255
+ <!-- default values for query parameters -->
256
+ <lst name="defaults">
257
+ <str name="echoParams">explicit</str>
258
+ <str name="json.nl">map</str>
259
+ <!--
260
+ <int name="rows">10</int>
261
+ <str name="fl">*</str>
262
+ <str name="version">2.1</str>
263
+ -->
264
+ </lst>
265
+ </requestHandler>
266
+
267
+ <!-- DisMaxRequestHandler allows easy searching across multiple fields
268
+ for simple user-entered phrases.
269
+ see http://wiki.apache.org/solr/DisMaxRequestHandler
270
+ -->
271
+ <requestHandler name="dismax" class="solr.DisMaxRequestHandler" >
272
+ <lst name="defaults">
273
+ <str name="echoParams">explicit</str>
274
+ <float name="tie">0.01</float>
275
+ <str name="qf">
276
+ text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
277
+ </str>
278
+ <str name="pf">
279
+ text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9
280
+ </str>
281
+ <str name="bf">
282
+ ord(poplarity)^0.5 recip(rord(price),1,1000,1000)^0.3
283
+ </str>
284
+ <str name="fl">
285
+ id,name,price,score
286
+ </str>
287
+ <str name="mm">
288
+ 2&lt;-1 5&lt;-2 6&lt;90%
289
+ </str>
290
+ <int name="ps">100</int>
291
+ <str name="q.alt">*:*</str>
292
+ </lst>
293
+ </requestHandler>
294
+
295
+ <!-- Note how you can register the same handler multiple times with
296
+ different names (and different init parameters)
297
+ -->
298
+ <requestHandler name="partitioned" class="solr.DisMaxRequestHandler" >
299
+ <lst name="defaults">
300
+ <str name="echoParams">explicit</str>
301
+ <str name="qf">text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0</str>
302
+ <str name="mm">2&lt;-1 5&lt;-2 6&lt;90%</str>
303
+ <!-- This is an example of using Date Math to specify a constantly
304
+ moving date range in a config...
305
+ -->
306
+ <str name="bq">incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2</str>
307
+ </lst>
308
+ <!-- In addition to defaults, "appends" params can be specified
309
+ to identify values which should be appended to the list of
310
+ multi-val params from the query (or the existing "defaults").
311
+
312
+ In this example, the param "fq=instock:true" will be appended to
313
+ any query time fq params the user may specify, as a mechanism for
314
+ partitioning the index, independent of any user selected filtering
315
+ that may also be desired (perhaps as a result of faceted searching).
316
+
317
+ NOTE: there is *absolutely* nothing a client can do to prevent these
318
+ "appends" values from being used, so don't use this mechanism
319
+ unless you are sure you always want it.
320
+ -->
321
+ <lst name="appends">
322
+ <str name="fq">inStock:true</str>
323
+ </lst>
324
+ <!-- "invariants" are a way of letting the Solr maintainer lock down
325
+ the options available to Solr clients. Any params values
326
+ specified here are used regardless of what values may be specified
327
+ in either the query, the "defaults", or the "appends" params.
328
+
329
+ In this example, the facet.field and facet.query params are fixed,
330
+ limiting the facets clients can use. Faceting is not turned on by
331
+ default - but if the client does specify facet=true in the request,
332
+ these are the only facets they will be able to see counts for;
333
+ regardless of what other facet.field or facet.query params they
334
+ may specify.
335
+
336
+ NOTE: there is *absolutely* nothing a client can do to prevent these
337
+ "invariants" values from being used, so don't use this mechanism
338
+ unless you are sure you always want it.
339
+ -->
340
+ <lst name="invariants">
341
+ <str name="facet.field">cat</str>
342
+ <str name="facet.field">manu_exact</str>
343
+ <str name="facet.query">price:[* TO 500]</str>
344
+ <str name="facet.query">price:[500 TO *]</str>
345
+ </lst>
346
+ </requestHandler>
347
+
348
+ <requestHandler name="instock" class="solr.DisMaxRequestHandler" >
349
+ <!-- for legacy reasons, DisMaxRequestHandler will assume all init
350
+ params are "defaults" if you don't explicitly specify any defaults.
351
+ -->
352
+ <str name="fq">
353
+ inStock:true
354
+ </str>
355
+ <str name="qf">
356
+ text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
357
+ </str>
358
+ <str name="mm">
359
+ 2&lt;-1 5&lt;-2 6&lt;90%
360
+ </str>
361
+ </requestHandler>
362
+
363
+
364
+ <!-- SpellCheckerRequestHandler takes in a word (or several words) as the
365
+ value of the "q" parameter and returns a list of alternative spelling
366
+ suggestions. If invoked with a ...&cmd=rebuild, it will rebuild the
367
+ spellchecker index.
368
+ -->
369
+ <requestHandler name="spellchecker" class="solr.SpellCheckerRequestHandler" startup="lazy">
370
+ <!-- default values for query parameters -->
371
+ <lst name="defaults">
372
+ <int name="suggestionCount">1</int>
373
+ <float name="accuracy">0.5</float>
374
+ </lst>
375
+
376
+ <!-- Main init params for handler -->
377
+
378
+ <!-- The directory where your SpellChecker Index should live. -->
379
+ <!-- May be absolute, or relative to the Solr "dataDir" directory. -->
380
+ <!-- If this option is not specified, a RAM directory will be used -->
381
+ <str name="spellcheckerIndexDir">spell</str>
382
+
383
+ <!-- the field in your schema that you want to be able to build -->
384
+ <!-- your spell index on. This should be a field that uses a very -->
385
+ <!-- simple FieldType without a lot of Analysis (ie: string) -->
386
+ <str name="termSourceField">word</str>
387
+
388
+ </requestHandler>
389
+
390
+
391
+ <!-- Update request handler.
392
+
393
+ Note: Since solr1.1 requestHandlers requires a valid content type header if posted in
394
+ the body. For example, curl now requires: -H 'Content-type:text/xml; charset=utf-8'
395
+ The response format differs from solr1.1 formatting and returns a standard error code.
396
+
397
+ To enable solr1.1 behavior, remove the /update handler or change its path
398
+ -->
399
+ <requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />
400
+
401
+ <!-- CSV update handler, loaded on demand -->
402
+ <requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy" />
403
+
404
+
405
+ <!-- Admin Handlers. TODO? There could be a single handler that loads them all... -->
406
+ <requestHandler name="/admin/luke" class="org.apache.solr.handler.admin.LukeRequestHandler" />
407
+ <requestHandler name="/admin/system" class="org.apache.solr.handler.admin.SystemInfoHandler" />
408
+ <requestHandler name="/admin/plugins" class="org.apache.solr.handler.admin.PluginInfoHandler" />
409
+ <requestHandler name="/admin/threads" class="org.apache.solr.handler.admin.ThreadDumpHandler" />
410
+ <requestHandler name="/admin/properties" class="org.apache.solr.handler.admin.PropertiesRequestHandler" />
411
+
412
+ <!-- Echo the request contents back to the client -->
413
+ <requestHandler name="/debug/dump" class="solr.DumpRequestHandler" >
414
+ <lst name="defaults">
415
+ <str name="echoParams">explicit</str> <!-- for all params (including the default etc) use: 'all' -->
416
+ <str name="echoHandler">true</str>
417
+ </lst>
418
+ </requestHandler>
419
+
420
+ <!-- queryResponseWriter plugins... query responses will be written using the
421
+ writer specified by the 'wt' request parameter matching the name of a registered
422
+ writer.
423
+ The "standard" writer is the default and will be used if 'wt' is not specified
424
+ in the request. XMLResponseWriter will be used if nothing is specified here.
425
+ The json, python, and ruby writers are also available by default.
426
+
427
+ <queryResponseWriter name="standard" class="org.apache.solr.request.XMLResponseWriter"/>
428
+ <queryResponseWriter name="json" class="org.apache.solr.request.JSONResponseWriter"/>
429
+ <queryResponseWriter name="python" class="org.apache.solr.request.PythonResponseWriter"/>
430
+ <queryResponseWriter name="ruby" class="org.apache.solr.request.RubyResponseWriter"/>
431
+
432
+ <queryResponseWriter name="custom" class="com.example.MyResponseWriter"/>
433
+ -->
434
+
435
+ <!-- XSLT response writer transforms the XML output by any xslt file found
436
+ in Solr's conf/xslt directory. Changes to xslt files are checked for
437
+ every xsltCacheLifetimeSeconds.
438
+ -->
439
+ <queryResponseWriter name="xslt" class="org.apache.solr.request.XSLTResponseWriter">
440
+ <int name="xsltCacheLifetimeSeconds">5</int>
441
+ </queryResponseWriter>
442
+
443
+ <!-- config for the admin interface -->
444
+ <admin>
445
+ <defaultQuery>solr</defaultQuery>
446
+ <gettableFiles>solrconfig.xml schema.xml admin-extra.html</gettableFiles>
447
+ <!-- pingQuery should be "URLish" ...
448
+ &amp; separated key=val pairs ... but there shouldn't be any
449
+ URL escaping of the values -->
450
+ <pingQuery>
451
+ qt=standard&amp;q=solrpingquery
452
+ </pingQuery>
453
+ <!-- configure a healthcheck file for servers behind a loadbalancer
454
+ <healthcheck type="file">server-enabled</healthcheck>
455
+ -->
456
+ </admin>
457
+
458
+ </config>