erichummel-sunspot 1.2.1 → 2.0.0.pre.111215

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. data/.gitignore +0 -1
  2. data/Gemfile +2 -1
  3. data/History.txt +30 -0
  4. data/Rakefile +5 -9
  5. data/lib/sunspot.rb +13 -3
  6. data/lib/sunspot/batcher.rb +62 -0
  7. data/lib/sunspot/class_set.rb +23 -0
  8. data/lib/sunspot/configuration.rb +7 -0
  9. data/lib/sunspot/dsl.rb +1 -1
  10. data/lib/sunspot/dsl/field_group.rb +57 -0
  11. data/lib/sunspot/dsl/field_query.rb +48 -0
  12. data/lib/sunspot/dsl/function.rb +13 -0
  13. data/lib/sunspot/dsl/paginatable.rb +5 -1
  14. data/lib/sunspot/dsl/restriction_with_near.rb +39 -0
  15. data/lib/sunspot/dsl/scope.rb +4 -4
  16. data/lib/sunspot/dsl/search.rb +2 -2
  17. data/lib/sunspot/dsl/standard_query.rb +2 -0
  18. data/lib/sunspot/indexer.rb +12 -7
  19. data/lib/sunspot/query.rb +3 -3
  20. data/lib/sunspot/query/bbox.rb +15 -0
  21. data/lib/sunspot/query/common_query.rb +13 -2
  22. data/lib/sunspot/query/dismax.rb +5 -1
  23. data/lib/sunspot/query/field_group.rb +36 -0
  24. data/lib/sunspot/query/geofilt.rb +16 -0
  25. data/lib/sunspot/query/highlighting.rb +8 -1
  26. data/lib/sunspot/query/pagination.rb +8 -4
  27. data/lib/sunspot/query/sort.rb +14 -0
  28. data/lib/sunspot/query/sort_composite.rb +3 -2
  29. data/lib/sunspot/search.rb +1 -1
  30. data/lib/sunspot/search/abstract_search.rb +53 -65
  31. data/lib/sunspot/search/field_group.rb +32 -0
  32. data/lib/sunspot/search/group.rb +50 -0
  33. data/lib/sunspot/search/hit.rb +21 -7
  34. data/lib/sunspot/search/hit_enumerable.rb +72 -0
  35. data/lib/sunspot/search/paginated_collection.rb +5 -3
  36. data/lib/sunspot/session.rb +3 -1
  37. data/lib/sunspot/type.rb +21 -0
  38. data/lib/sunspot/util.rb +9 -0
  39. data/lib/sunspot/version.rb +1 -1
  40. data/spec/api/batcher_spec.rb +112 -0
  41. data/spec/api/class_set_spec.rb +24 -0
  42. data/spec/api/hit_enumerable_spec.rb +47 -0
  43. data/spec/api/indexer/batch_spec.rb +29 -3
  44. data/spec/api/query/function_spec.rb +9 -0
  45. data/spec/api/query/group_spec.rb +32 -0
  46. data/spec/api/query/highlighting_examples.rb +22 -0
  47. data/spec/api/query/ordering_pagination_examples.rb +21 -0
  48. data/spec/api/query/spatial_examples.rb +27 -0
  49. data/spec/api/query/standard_spec.rb +1 -0
  50. data/spec/api/search/hits_spec.rb +11 -0
  51. data/spec/api/search/paginated_collection_spec.rb +10 -0
  52. data/spec/api/search/results_spec.rb +6 -0
  53. data/spec/api/session_proxy/thread_local_session_proxy_spec.rb +0 -11
  54. data/spec/api/session_spec.rb +12 -0
  55. data/spec/api/sunspot_spec.rb +11 -0
  56. data/spec/helpers/indexer_helper.rb +0 -12
  57. data/spec/helpers/integration_helper.rb +8 -0
  58. data/spec/helpers/mock_session_helper.rb +13 -0
  59. data/spec/helpers/query_helper.rb +0 -12
  60. data/spec/helpers/search_helper.rb +0 -12
  61. data/spec/integration/dynamic_fields_spec.rb +2 -0
  62. data/spec/integration/faceting_spec.rb +14 -1
  63. data/spec/integration/field_grouping_spec.rb +66 -0
  64. data/spec/integration/geospatial_spec.rb +85 -0
  65. data/spec/integration/highlighting_spec.rb +22 -0
  66. data/spec/integration/indexing_spec.rb +23 -1
  67. data/spec/integration/keyword_search_spec.rb +1 -1
  68. data/spec/integration/local_search_spec.rb +1 -1
  69. data/spec/integration/more_like_this_spec.rb +1 -1
  70. data/spec/integration/scoped_search_spec.rb +1 -1
  71. data/spec/integration/stored_fields_spec.rb +2 -0
  72. data/spec/integration/test_pagination.rb +13 -2
  73. data/spec/integration/unicode_spec.rb +15 -0
  74. data/spec/mocks/connection.rb +4 -4
  75. data/spec/mocks/post.rb +1 -0
  76. data/spec/spec_helper.rb +21 -11
  77. data/sunspot.gemspec +42 -0
  78. data/tasks/rdoc.rake +2 -2
  79. metadata +95 -135
  80. data/VERSION.yml +0 -4
  81. data/bin/sunspot-installer +0 -19
  82. data/bin/sunspot-solr +0 -74
  83. data/installer/config/schema.yml +0 -95
  84. data/lib/sunspot/installer.rb +0 -31
  85. data/lib/sunspot/installer/library_installer.rb +0 -45
  86. data/lib/sunspot/installer/schema_builder.rb +0 -219
  87. data/lib/sunspot/installer/solrconfig_updater.rb +0 -76
  88. data/lib/sunspot/installer/task_helper.rb +0 -18
  89. data/lib/sunspot/server.rb +0 -152
  90. data/solr-1.3/etc/jetty.xml +0 -212
  91. data/solr-1.3/etc/webdefault.xml +0 -379
  92. data/solr-1.3/lib/jetty-6.1.3.jar +0 -0
  93. data/solr-1.3/lib/jetty-util-6.1.3.jar +0 -0
  94. data/solr-1.3/lib/jsp-2.1/ant-1.6.5.jar +0 -0
  95. data/solr-1.3/lib/jsp-2.1/core-3.1.1.jar +0 -0
  96. data/solr-1.3/lib/jsp-2.1/jsp-2.1.jar +0 -0
  97. data/solr-1.3/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
  98. data/solr-1.3/lib/servlet-api-2.5-6.1.3.jar +0 -0
  99. data/solr-1.3/solr/conf/elevate.xml +0 -36
  100. data/solr-1.3/solr/conf/protwords.txt +0 -21
  101. data/solr-1.3/solr/conf/schema.xml +0 -64
  102. data/solr-1.3/solr/conf/solrconfig.xml +0 -725
  103. data/solr-1.3/solr/conf/stopwords.txt +0 -57
  104. data/solr-1.3/solr/conf/synonyms.txt +0 -31
  105. data/solr-1.3/solr/lib/geoapi-nogenerics-2.1-M2.jar +0 -0
  106. data/solr-1.3/solr/lib/gt2-referencing-2.3.1.jar +0 -0
  107. data/solr-1.3/solr/lib/jsr108-0.01.jar +0 -0
  108. data/solr-1.3/solr/lib/locallucene.jar +0 -0
  109. data/solr-1.3/solr/lib/localsolr.jar +0 -0
  110. data/solr-1.3/start.jar +0 -0
  111. data/solr-1.3/webapps/solr.war +0 -0
  112. data/solr/README.txt +0 -42
  113. data/solr/etc/jetty.xml +0 -218
  114. data/solr/etc/webdefault.xml +0 -379
  115. data/solr/lib/jetty-6.1.3.jar +0 -0
  116. data/solr/lib/jetty-util-6.1.3.jar +0 -0
  117. data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
  118. data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
  119. data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
  120. data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
  121. data/solr/lib/servlet-api-2.5-6.1.3.jar +0 -0
  122. data/solr/solr/.gitignore +0 -1
  123. data/solr/solr/README.txt +0 -54
  124. data/solr/solr/conf/admin-extra.html +0 -31
  125. data/solr/solr/conf/elevate.xml +0 -36
  126. data/solr/solr/conf/mapping-ISOLatin1Accent.txt +0 -246
  127. data/solr/solr/conf/protwords.txt +0 -21
  128. data/solr/solr/conf/schema.xml +0 -238
  129. data/solr/solr/conf/scripts.conf +0 -24
  130. data/solr/solr/conf/solrconfig.xml +0 -934
  131. data/solr/solr/conf/spellings.txt +0 -2
  132. data/solr/solr/conf/stopwords.txt +0 -58
  133. data/solr/solr/conf/synonyms.txt +0 -31
  134. data/solr/solr/conf/xslt/example.xsl +0 -132
  135. data/solr/solr/conf/xslt/example_atom.xsl +0 -67
  136. data/solr/solr/conf/xslt/example_rss.xsl +0 -66
  137. data/solr/solr/conf/xslt/luke.xsl +0 -337
  138. data/solr/start.jar +0 -0
  139. data/solr/webapps/solr.war +0 -0
  140. data/spec/api/server_spec.rb +0 -91
  141. data/spec/integration/spec_helper.rb +0 -7
@@ -1,64 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <schema version="0.9" name="sunspot">
3
- <types>
4
- <fieldtype class="solr.TextField" positionIncrementGap="100" name="text">
5
- <analyzer>
6
- <tokenizer class="solr.StandardTokenizerFactory"/>
7
- <filter class="solr.StandardFilterFactory"/>
8
- <filter class="solr.LowerCaseFilterFactory"/>
9
- </analyzer>
10
- </fieldtype>
11
- <fieldtype class="solr.RandomSortField" name="rand"/>
12
- <fieldtype name="boolean" class="solr.BoolField" omitNorms="true"/>
13
- <fieldtype name="sfloat" class="solr.SortableFloatField" omitNorms="true"/>
14
- <fieldtype name="date" class="solr.DateField" omitNorms="true"/>
15
- <fieldtype name="sint" class="solr.SortableIntField" omitNorms="true"/>
16
- <fieldtype name="string" class="solr.StrField" omitNorms="true"/>
17
- <fieldtype name="sdouble" class="solr.SortableDoubleField" omitNorms="true"/>
18
- <fieldtype name="slong" class="solr.SortableLongField" omitNorms="true"/>
19
- </types>
20
- <fields>
21
- <field name="id" type="string" indexed="true" stored="true" multiValued="false" />
22
- <field name="type" type="string" indexed="true" stored="false" multiValued="true" />
23
- <field name="class_name" type="string" indexed="true" stored="false" multiValued="false" />
24
- <field name="text" type="text" indexed="true" stored="false" multiValued="true" />
25
- <field name="lat" type="sdouble" indexed="true" stored="true" multiValued="false" />
26
- <field name="long" type="sdouble" indexed="true" stored="true" multiValued="false" />
27
- <dynamicField name="*_text" type="text" indexed="true" stored="false" multiValued="true" />
28
- <dynamicField name="*_texts" type="text" indexed="true" stored="true" multiValued="true" />
29
- <dynamicField name="random_*" type="rand" indexed="true" stored="false" multiValued="false" />
30
- <dynamicField name="_local*" type="sdouble" indexed="true" stored="false" multiValued="false" />
31
- <dynamicField name="*_b" type="boolean" indexed="true" stored="false" multiValued="false" />
32
- <dynamicField name="*_f" type="sfloat" indexed="true" stored="false" multiValued="false" />
33
- <dynamicField name="*_d" type="date" indexed="true" stored="false" multiValued="false" />
34
- <dynamicField name="*_i" type="sint" indexed="true" stored="false" multiValued="false" />
35
- <dynamicField name="*_s" type="string" indexed="true" stored="false" multiValued="false" />
36
- <dynamicField name="*_e" type="sdouble" indexed="true" stored="false" multiValued="false" />
37
- <dynamicField name="*_l" type="slong" indexed="true" stored="false" multiValued="false" />
38
- <dynamicField name="*_bm" type="boolean" indexed="true" stored="false" multiValued="true" />
39
- <dynamicField name="*_fm" type="sfloat" indexed="true" stored="false" multiValued="true" />
40
- <dynamicField name="*_dm" type="date" indexed="true" stored="false" multiValued="true" />
41
- <dynamicField name="*_im" type="sint" indexed="true" stored="false" multiValued="true" />
42
- <dynamicField name="*_sm" type="string" indexed="true" stored="false" multiValued="true" />
43
- <dynamicField name="*_em" type="sdouble" indexed="true" stored="false" multiValued="true" />
44
- <dynamicField name="*_lm" type="slong" indexed="true" stored="false" multiValued="true" />
45
- <dynamicField name="*_bs" type="boolean" indexed="true" stored="true" multiValued="false" />
46
- <dynamicField name="*_fs" type="sfloat" indexed="true" stored="true" multiValued="false" />
47
- <dynamicField name="*_ds" type="date" indexed="true" stored="true" multiValued="false" />
48
- <dynamicField name="*_is" type="sint" indexed="true" stored="true" multiValued="false" />
49
- <dynamicField name="*_ss" type="string" indexed="true" stored="true" multiValued="false" />
50
- <dynamicField name="*_es" type="sdouble" indexed="true" stored="true" multiValued="false" />
51
- <dynamicField name="*_ls" type="slong" indexed="true" stored="true" multiValued="false" />
52
- <dynamicField name="*_bms" type="boolean" indexed="true" stored="true" multiValued="true" />
53
- <dynamicField name="*_fms" type="sfloat" indexed="true" stored="true" multiValued="true" />
54
- <dynamicField name="*_dms" type="date" indexed="true" stored="true" multiValued="true" />
55
- <dynamicField name="*_ims" type="sint" indexed="true" stored="true" multiValued="true" />
56
- <dynamicField name="*_sms" type="string" indexed="true" stored="true" multiValued="true" />
57
- <dynamicField name="*_ems" type="sdouble" indexed="true" stored="true" multiValued="true" />
58
- <dynamicField name="*_lms" type="slong" indexed="true" stored="true" multiValued="true" />
59
- </fields>
60
- <uniqueKey>id</uniqueKey>
61
- <defaultSearchField>text</defaultSearchField>
62
- <solrQueryParser defaultOperator="AND"/>
63
- <copyField dest="text" source="*_text"/>
64
- </schema>
@@ -1,725 +0,0 @@
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
- <queryParser name="lucene" class="org.apache.solr.search.LuceneQParserPlugin"/>
686
-
687
- <!-- example of registering a custom function parser
688
- <valueSourceParser name="myfunc" class="com.mycompany.MyValueSourceParser" />
689
- -->
690
-
691
- <!-- config for the admin interface -->
692
- <admin>
693
- <defaultQuery>solr</defaultQuery>
694
-
695
- <!-- configure a healthcheck file for servers behind a loadbalancer
696
- <healthcheck type="file">server-enabled</healthcheck>
697
- -->
698
- </admin>
699
-
700
- <!-- configuration for LocalSolr -->
701
- <updateRequestProcessorChain>
702
- <processor class='com.pjaol.search.solr.update.LocalUpdateProcessorFactory'>
703
- <str name='latField'>lat</str>
704
- <str name='lngField'>long</str>
705
- <int name='startTier'>9</int>
706
- <int name='endTier'>16</int>
707
- </processor>
708
- <processor class='solr.RunUpdateProcessorFactory'></processor>
709
- <processor class='solr.LogUpdateProcessorFactory'></processor>
710
- </updateRequestProcessorChain>
711
- <searchComponent class='com.pjaol.search.solr.component.LocalSolrQueryComponent' name='localsolr'>
712
- <str name='latField'>lat</str>
713
- <str name='lngField'>long</str>
714
- </searchComponent>
715
- <requestHandler class='org.apache.solr.handler.component.SearchHandler' name='geo'>
716
- <str name="defType">lucene</str>
717
- <arr name='components'>
718
- <str>localsolr</str>
719
- <str>facet</str>
720
- <str>mlt</str>
721
- <str>highlight</str>
722
- <str>debug</str>
723
- </arr>
724
- </requestHandler>
725
- </config>