websolr-rails 1.4.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -10
- data/LICENSE +17 -16
- data/README.rdoc +16 -62
- data/Rakefile +2 -60
- data/VERSION +1 -1
- data/lib/websolr-rails.rb +54 -1
- data/lib/websolr.rb +2 -1
- metadata +12 -215
- data/CHANGELOG +0 -8
- data/TESTING_THE_PLUGIN +0 -25
- data/bin/websolr +0 -10
- data/config/solr.yml +0 -15
- data/config/solr_environment.rb +0 -22
- data/generate_rdoc.sh +0 -13
- data/lib/acts_as_solr.rb +0 -65
- data/lib/acts_methods.rb +0 -281
- data/lib/class_methods.rb +0 -243
- data/lib/common_methods.rb +0 -89
- data/lib/deprecation.rb +0 -61
- data/lib/instance_methods.rb +0 -181
- data/lib/lazy_document.rb +0 -18
- data/lib/parser_methods.rb +0 -230
- data/lib/search_results.rb +0 -72
- data/lib/solr.rb +0 -21
- data/lib/solr/connection.rb +0 -190
- data/lib/solr/document.rb +0 -78
- data/lib/solr/exception.rb +0 -13
- data/lib/solr/field.rb +0 -39
- data/lib/solr/importer.rb +0 -19
- data/lib/solr/importer/array_mapper.rb +0 -26
- data/lib/solr/importer/delimited_file_source.rb +0 -38
- data/lib/solr/importer/hpricot_mapper.rb +0 -27
- data/lib/solr/importer/mapper.rb +0 -51
- data/lib/solr/importer/solr_source.rb +0 -43
- data/lib/solr/importer/xpath_mapper.rb +0 -35
- data/lib/solr/indexer.rb +0 -52
- data/lib/solr/request.rb +0 -26
- data/lib/solr/request/add_document.rb +0 -63
- data/lib/solr/request/base.rb +0 -36
- data/lib/solr/request/commit.rb +0 -31
- data/lib/solr/request/delete.rb +0 -50
- data/lib/solr/request/dismax.rb +0 -46
- data/lib/solr/request/index_info.rb +0 -22
- data/lib/solr/request/modify_document.rb +0 -51
- data/lib/solr/request/optimize.rb +0 -21
- data/lib/solr/request/ping.rb +0 -36
- data/lib/solr/request/select.rb +0 -56
- data/lib/solr/request/spellcheck.rb +0 -30
- data/lib/solr/request/standard.rb +0 -402
- data/lib/solr/request/update.rb +0 -23
- data/lib/solr/response.rb +0 -27
- data/lib/solr/response/add_document.rb +0 -17
- data/lib/solr/response/base.rb +0 -42
- data/lib/solr/response/commit.rb +0 -17
- data/lib/solr/response/delete.rb +0 -13
- data/lib/solr/response/dismax.rb +0 -8
- data/lib/solr/response/index_info.rb +0 -26
- data/lib/solr/response/modify_document.rb +0 -17
- data/lib/solr/response/optimize.rb +0 -14
- data/lib/solr/response/ping.rb +0 -28
- data/lib/solr/response/ruby.rb +0 -42
- data/lib/solr/response/select.rb +0 -17
- data/lib/solr/response/spellcheck.rb +0 -20
- data/lib/solr/response/standard.rb +0 -64
- data/lib/solr/response/xml.rb +0 -42
- data/lib/solr/solrtasks.rb +0 -27
- data/lib/solr/util.rb +0 -32
- data/lib/solr/xml.rb +0 -44
- data/lib/solr_fixtures.rb +0 -13
- data/lib/tasks/database.rake +0 -18
- data/lib/tasks/solr.rake +0 -94
- data/lib/tasks/test.rake +0 -7
- data/lib/websolr_controller.rb +0 -233
- data/lib/websolr_option_parser.rb +0 -61
- data/lib/websolr_rails.rb +0 -1
- data/lib/websolr_rails/tasks.rb +0 -4
- data/lib/will_paginate_support.rb +0 -12
- data/solr/CHANGES.txt +0 -1207
- data/solr/LICENSE.txt +0 -712
- data/solr/NOTICE.txt +0 -90
- data/solr/etc/jetty.xml +0 -205
- data/solr/etc/webdefault.xml +0 -379
- data/solr/lib/easymock.jar +0 -0
- data/solr/lib/jetty-6.1.3.jar +0 -0
- data/solr/lib/jetty-util-6.1.3.jar +0 -0
- data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
- data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
- data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
- data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
- data/solr/lib/servlet-api-2.4.jar +0 -0
- data/solr/lib/servlet-api-2.5-6.1.3.jar +0 -0
- data/solr/lib/xpp3-1.1.3.4.O.jar +0 -0
- data/solr/logs/.empty-dir-for-git +0 -0
- data/solr/solr/README.txt +0 -52
- data/solr/solr/bin/abc +0 -176
- data/solr/solr/bin/abo +0 -176
- data/solr/solr/bin/backup +0 -108
- data/solr/solr/bin/backupcleaner +0 -142
- data/solr/solr/bin/commit +0 -128
- data/solr/solr/bin/optimize +0 -129
- data/solr/solr/bin/readercycle +0 -129
- data/solr/solr/bin/rsyncd-disable +0 -77
- data/solr/solr/bin/rsyncd-enable +0 -76
- data/solr/solr/bin/rsyncd-start +0 -145
- data/solr/solr/bin/rsyncd-stop +0 -105
- data/solr/solr/bin/scripts-util +0 -83
- data/solr/solr/bin/snapcleaner +0 -148
- data/solr/solr/bin/snapinstaller +0 -168
- data/solr/solr/bin/snappuller +0 -248
- data/solr/solr/bin/snappuller-disable +0 -77
- data/solr/solr/bin/snappuller-enable +0 -77
- data/solr/solr/bin/snapshooter +0 -109
- data/solr/solr/conf/admin-extra.html +0 -31
- data/solr/solr/conf/protwords.txt +0 -21
- data/solr/solr/conf/schema.xml +0 -126
- data/solr/solr/conf/scripts.conf +0 -24
- data/solr/solr/conf/solrconfig.xml +0 -458
- data/solr/solr/conf/stopwords.txt +0 -57
- data/solr/solr/conf/synonyms.txt +0 -31
- data/solr/solr/conf/xslt/example.xsl +0 -132
- data/solr/solr/conf/xslt/example_atom.xsl +0 -63
- data/solr/solr/conf/xslt/example_rss.xsl +0 -62
- data/solr/start.jar +0 -0
- data/solr/tmp/.empty-dir-for-git +0 -0
- data/solr/webapps/solr.war +0 -0
- data/test/config/solr.yml +0 -2
- data/test/db/connections/mysql/connection.rb +0 -10
- data/test/db/connections/sqlite/connection.rb +0 -8
- data/test/db/migrate/001_create_books.rb +0 -15
- data/test/db/migrate/002_create_movies.rb +0 -12
- data/test/db/migrate/003_create_categories.rb +0 -11
- data/test/db/migrate/004_create_electronics.rb +0 -16
- data/test/db/migrate/005_create_authors.rb +0 -12
- data/test/db/migrate/006_create_postings.rb +0 -9
- data/test/db/migrate/007_create_posts.rb +0 -13
- data/test/db/migrate/008_create_gadgets.rb +0 -11
- data/test/fixtures/authors.yml +0 -9
- data/test/fixtures/books.yml +0 -13
- data/test/fixtures/categories.yml +0 -7
- data/test/fixtures/db_definitions/mysql.sql +0 -41
- data/test/fixtures/electronics.yml +0 -49
- data/test/fixtures/movies.yml +0 -9
- data/test/fixtures/postings.yml +0 -10
- data/test/functional/acts_as_solr_test.rb +0 -413
- data/test/functional/association_indexing_test.rb +0 -37
- data/test/functional/faceted_search_test.rb +0 -163
- data/test/functional/multi_solr_search_test.rb +0 -51
- data/test/models/author.rb +0 -10
- data/test/models/book.rb +0 -10
- data/test/models/category.rb +0 -8
- data/test/models/electronic.rb +0 -21
- data/test/models/gadget.rb +0 -9
- data/test/models/movie.rb +0 -17
- data/test/models/novel.rb +0 -2
- data/test/models/post.rb +0 -3
- data/test/models/posting.rb +0 -11
- data/test/test_helper.rb +0 -51
- data/test/unit/acts_methods_shoulda.rb +0 -70
- data/test/unit/class_methods_shoulda.rb +0 -88
- data/test/unit/common_methods_shoulda.rb +0 -112
- data/test/unit/instance_methods_shoulda.rb +0 -326
- data/test/unit/lazy_document_shoulda.rb +0 -35
- data/test/unit/parser_instance.rb +0 -19
- data/test/unit/parser_methods_shoulda.rb +0 -278
- data/test/unit/solr_instance.rb +0 -46
- data/test/unit/test_helper.rb +0 -14
- data/websolr-rails.gemspec +0 -243
@@ -1,402 +0,0 @@
|
|
1
|
-
# The ASF licenses this file to You under the Apache License, Version 2.0
|
2
|
-
# (the "License"); you may not use this file except in compliance with
|
3
|
-
# the License. You may obtain a copy of the License at
|
4
|
-
#
|
5
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
6
|
-
#
|
7
|
-
# Unless required by applicable law or agreed to in writing, software
|
8
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
-
# See the License for the specific language governing permissions and
|
11
|
-
# limitations under the License.
|
12
|
-
|
13
|
-
class Solr::Request::Standard < Solr::Request::Select
|
14
|
-
|
15
|
-
VALID_PARAMS = [:query, :sort, :default_field, :operator, :start, :rows, :shards, :date_facets,
|
16
|
-
:filter_queries, :field_list, :debug_query, :explain_other, :facets, :highlighting, :mlt]
|
17
|
-
|
18
|
-
def initialize(params)
|
19
|
-
super('standard')
|
20
|
-
|
21
|
-
raise "Invalid parameters: #{(params.keys - VALID_PARAMS).join(',')}" unless
|
22
|
-
(params.keys - VALID_PARAMS).empty?
|
23
|
-
|
24
|
-
raise ":query parameter required" unless params[:query]
|
25
|
-
|
26
|
-
@params = params.dup
|
27
|
-
|
28
|
-
# Validate operator
|
29
|
-
if params[:operator]
|
30
|
-
raise "Only :and/:or operators allowed" unless
|
31
|
-
[:and, :or].include?(params[:operator])
|
32
|
-
|
33
|
-
@params[:operator] = params[:operator].to_s.upcase
|
34
|
-
end
|
35
|
-
|
36
|
-
# Validate start, rows can be transformed to ints
|
37
|
-
@params[:start] = params[:start].to_i if params[:start]
|
38
|
-
@params[:rows] = params[:rows].to_i if params[:rows]
|
39
|
-
|
40
|
-
@params[:field_list] ||= ["*","score"]
|
41
|
-
|
42
|
-
@params[:shards] ||= []
|
43
|
-
end
|
44
|
-
|
45
|
-
def to_hash
|
46
|
-
hash = {}
|
47
|
-
|
48
|
-
# standard request param processing
|
49
|
-
sort = @params[:sort].collect do |sort|
|
50
|
-
key = sort.keys[0]
|
51
|
-
"#{key.to_s} #{sort[key] == :descending ? 'desc' : 'asc'}"
|
52
|
-
end.join(',') if @params[:sort]
|
53
|
-
hash[:q] = sort ? "#{@params[:query]};#{sort}" : @params[:query]
|
54
|
-
hash["q.op"] = @params[:operator]
|
55
|
-
hash[:df] = @params[:default_field]
|
56
|
-
|
57
|
-
# common parameter processing
|
58
|
-
hash[:start] = @params[:start]
|
59
|
-
hash[:rows] = @params[:rows]
|
60
|
-
hash[:fq] = @params[:filter_queries]
|
61
|
-
hash[:fl] = @params[:field_list].join(',')
|
62
|
-
hash[:debugQuery] = @params[:debug_query]
|
63
|
-
hash[:explainOther] = @params[:explain_other]
|
64
|
-
hash[:shards] = @params[:shards].join(',') unless @params[:shards].empty?
|
65
|
-
|
66
|
-
# facet parameter processing
|
67
|
-
if @params[:facets]
|
68
|
-
# TODO need validation of all that is under the :facets Hash too
|
69
|
-
hash[:facet] = true
|
70
|
-
hash["facet.field"] = []
|
71
|
-
hash["facet.query"] = @params[:facets][:queries]
|
72
|
-
hash["facet.sort"] = (@params[:facets][:sort] == :count) if @params[:facets][:sort]
|
73
|
-
hash["facet.limit"] = @params[:facets][:limit]
|
74
|
-
hash["facet.missing"] = @params[:facets][:missing]
|
75
|
-
hash["facet.mincount"] = @params[:facets][:mincount]
|
76
|
-
hash["facet.prefix"] = @params[:facets][:prefix]
|
77
|
-
hash["facet.offset"] = @params[:facets][:offset]
|
78
|
-
if @params[:facets][:fields] # facet fields are optional (could be facet.query only)
|
79
|
-
@params[:facets][:fields].each do |f|
|
80
|
-
if f.kind_of? Hash
|
81
|
-
key = f.keys[0]
|
82
|
-
value = f[key]
|
83
|
-
hash["facet.field"] << key
|
84
|
-
hash["f.#{key}.facet.sort"] = (value[:sort] == :count) if value[:sort]
|
85
|
-
hash["f.#{key}.facet.limit"] = value[:limit]
|
86
|
-
hash["f.#{key}.facet.missing"] = value[:missing]
|
87
|
-
hash["f.#{key}.facet.mincount"] = value[:mincount]
|
88
|
-
hash["f.#{key}.facet.prefix"] = value[:prefix]
|
89
|
-
hash["f.#{key}.facet.offset"] = value[:offset]
|
90
|
-
else
|
91
|
-
hash["facet.field"] << f
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
if @params[:date_facets]
|
97
|
-
hash["facet.date"] = []
|
98
|
-
if @params[:date_facets][:fields]
|
99
|
-
@params[:date_facets][:fields].each do |f|
|
100
|
-
if f.kind_of? Hash
|
101
|
-
key = f.keys[0]
|
102
|
-
hash["facet.date"] << key
|
103
|
-
f[key].each { |k, v|
|
104
|
-
hash["f.#{key}.facet.date.#{k}"] = v
|
105
|
-
}
|
106
|
-
else
|
107
|
-
hash["facet.date"] << f
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
hash["facet.date.start"] = @params[:date_facets][:start]
|
112
|
-
hash["facet.date.end"] = @params[:date_facets][:end]
|
113
|
-
hash["facet.date.gap"] = @params[:date_facets][:gap]
|
114
|
-
hash["facet.date.other"] = @params[:date_facets][:other]
|
115
|
-
hash["facet.date.hardend"] = @params[:date_facets][:hardend]
|
116
|
-
if @params[:date_facets][:filter]
|
117
|
-
if hash[:fq]
|
118
|
-
hash[:fq] << @params[:date_facets][:filter]
|
119
|
-
else
|
120
|
-
hash[:fq] = @params[:date_facets][:filter]
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
# highlighting parameter processing - http://wiki.apache.org/solr/HighlightingParameters
|
127
|
-
if @params[:highlighting]
|
128
|
-
hash[:hl] = true
|
129
|
-
hash["hl.fl"] = @params[:highlighting][:field_list].join(',') if @params[:highlighting][:field_list]
|
130
|
-
|
131
|
-
snippets = @params[:highlighting][:max_snippets]
|
132
|
-
if snippets
|
133
|
-
if snippets.kind_of? Hash
|
134
|
-
if snippets[:default]
|
135
|
-
hash["hl.snippets"] = snippets[:default]
|
136
|
-
end
|
137
|
-
if snippets[:fields]
|
138
|
-
snippets[:fields].each do |k,v|
|
139
|
-
hash["f.#{k}.hl.snippets"] = v
|
140
|
-
end
|
141
|
-
end
|
142
|
-
else
|
143
|
-
hash["hl.snippets"] = snippets
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
fragsize = @params[:highlighting][:fragment_size]
|
148
|
-
if fragsize
|
149
|
-
if fragsize.kind_of? Hash
|
150
|
-
if fragsize[:default]
|
151
|
-
hash["hl.fragsize"] = fragsize[:default]
|
152
|
-
end
|
153
|
-
if fragsize[:fields]
|
154
|
-
fragsize[:fields].each do |k,v|
|
155
|
-
hash["f.#{k}.hl.fragsize"] = v
|
156
|
-
end
|
157
|
-
end
|
158
|
-
else
|
159
|
-
hash["hl.fragsize"] = fragsize
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
rfm = @params[:highlighting][:require_field_match]
|
164
|
-
if nil != rfm
|
165
|
-
if rfm.kind_of? Hash
|
166
|
-
if nil != rfm[:default]
|
167
|
-
hash["hl.requireFieldMatch"] = rfm[:default]
|
168
|
-
end
|
169
|
-
if rfm[:fields]
|
170
|
-
rfm[:fields].each do |k,v|
|
171
|
-
hash["f.#{k}.hl.requireFieldMatch"] = v
|
172
|
-
end
|
173
|
-
end
|
174
|
-
else
|
175
|
-
hash["hl.requireFieldMatch"] = rfm
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
mac = @params[:highlighting][:max_analyzed_chars]
|
180
|
-
if mac
|
181
|
-
if mac.kind_of? Hash
|
182
|
-
if mac[:default]
|
183
|
-
hash["hl.maxAnalyzedChars"] = mac[:default]
|
184
|
-
end
|
185
|
-
if mac[:fields]
|
186
|
-
mac[:fields].each do |k,v|
|
187
|
-
hash["f.#{k}.hl.maxAnalyzedChars"] = v
|
188
|
-
end
|
189
|
-
end
|
190
|
-
else
|
191
|
-
hash["hl.maxAnalyzedChars"] = mac
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
prefix = @params[:highlighting][:prefix]
|
196
|
-
if prefix
|
197
|
-
if prefix.kind_of? Hash
|
198
|
-
if prefix[:default]
|
199
|
-
hash["hl.simple.pre"] = prefix[:default]
|
200
|
-
end
|
201
|
-
if prefix[:fields]
|
202
|
-
prefix[:fields].each do |k,v|
|
203
|
-
hash["f.#{k}.hl.simple.pre"] = v
|
204
|
-
end
|
205
|
-
end
|
206
|
-
else
|
207
|
-
hash["hl.simple.pre"] = prefix
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
suffix = @params[:highlighting][:suffix]
|
212
|
-
if suffix
|
213
|
-
if suffix.kind_of? Hash
|
214
|
-
if suffix[:default]
|
215
|
-
hash["hl.simple.post"] = suffix[:default]
|
216
|
-
end
|
217
|
-
if suffix[:fields]
|
218
|
-
suffix[:fields].each do |k,v|
|
219
|
-
hash["f.#{k}.hl.simple.post"] = v
|
220
|
-
end
|
221
|
-
end
|
222
|
-
else
|
223
|
-
hash["hl.simple.post"] = suffix
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
formatter = @params[:highlighting][:formatter]
|
228
|
-
if formatter
|
229
|
-
if formatter.kind_of? Hash
|
230
|
-
if formatter[:default]
|
231
|
-
hash["hl.formatter"] = formatter[:default]
|
232
|
-
end
|
233
|
-
if formatter[:fields]
|
234
|
-
formatter[:fields].each do |k,v|
|
235
|
-
hash["f.#{k}.hl.formatter"] = v
|
236
|
-
end
|
237
|
-
end
|
238
|
-
else
|
239
|
-
hash["hl.formatter"] = formatter
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
fragmenter = @params[:highlighting][:fragmenter]
|
244
|
-
if fragmenter
|
245
|
-
if fragmenter.kind_of? Hash
|
246
|
-
if fragmenter[:default]
|
247
|
-
hash["hl.fragmenter"] = fragmenter[:default]
|
248
|
-
end
|
249
|
-
if fragmenter[:fields]
|
250
|
-
fragmenter[:fields].each do |k,v|
|
251
|
-
hash["f.#{k}.hl.fragmenter"] = v
|
252
|
-
end
|
253
|
-
end
|
254
|
-
else
|
255
|
-
hash["hl.fragmenter"] = fragmenter
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
merge_contiguous = @params[:highlighting][:merge_contiguous]
|
260
|
-
if nil != merge_contiguous
|
261
|
-
if merge_contiguous.kind_of? Hash
|
262
|
-
if nil != merge_contiguous[:default]
|
263
|
-
hash["hl.mergeContiguous"] = merge_contiguous[:default]
|
264
|
-
end
|
265
|
-
if merge_contiguous[:fields]
|
266
|
-
merge_contiguous[:fields].each do |k,v|
|
267
|
-
hash["f.#{k}.hl.mergeContiguous"] = v
|
268
|
-
end
|
269
|
-
end
|
270
|
-
else
|
271
|
-
hash["hl.mergeContiguous"] = merge_contiguous
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
increment = @params[:highlighting][:increment]
|
276
|
-
if increment
|
277
|
-
if increment.kind_of? Hash
|
278
|
-
if increment[:default]
|
279
|
-
hash["hl.increment"] = increment[:default]
|
280
|
-
end
|
281
|
-
if increment[:fields]
|
282
|
-
increment[:fields].each do |k,v|
|
283
|
-
hash["f.#{k}.hl.increment"] = v
|
284
|
-
end
|
285
|
-
end
|
286
|
-
else
|
287
|
-
hash["hl.increment"] = increment
|
288
|
-
end
|
289
|
-
end
|
290
|
-
|
291
|
-
# support "old style"
|
292
|
-
alternate_fields = @params[:highlighting][:alternate_fields]
|
293
|
-
if alternate_fields
|
294
|
-
alternate_fields.each do |f,v|
|
295
|
-
hash["f.#{f}.hl.alternateField"] = v
|
296
|
-
end
|
297
|
-
end
|
298
|
-
|
299
|
-
alternate_field = @params[:highlighting][:alternate_field]
|
300
|
-
if alternate_field
|
301
|
-
if alternate_field.kind_of? Hash
|
302
|
-
if alternate_field[:default]
|
303
|
-
hash["hl.alternateField"] = alternate_field[:default]
|
304
|
-
end
|
305
|
-
if alternate_field[:fields]
|
306
|
-
alternate_field[:fields].each do |k,v|
|
307
|
-
hash["f.#{k}.hl.alternateField"] = v
|
308
|
-
end
|
309
|
-
end
|
310
|
-
else
|
311
|
-
hash["hl.alternateField"] = alternate_field
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|
315
|
-
mafl = @params[:highlighting][:max_alternate_field_length]
|
316
|
-
if mafl
|
317
|
-
if mafl.kind_of? Hash
|
318
|
-
if mafl[:default]
|
319
|
-
hash["hl.maxAlternateFieldLength"] = mafl[:default]
|
320
|
-
end
|
321
|
-
if mafl[:fields]
|
322
|
-
mafl[:fields].each do |k,v|
|
323
|
-
hash["f.#{k}.hl.maxAlternateFieldLength"] = v
|
324
|
-
end
|
325
|
-
else
|
326
|
-
# support "old style"
|
327
|
-
mafl.each do |k,v|
|
328
|
-
hash["f.#{k}.hl.maxAlternateFieldLength"] = v
|
329
|
-
end
|
330
|
-
end
|
331
|
-
else
|
332
|
-
hash["hl.maxAlternateFieldLength"] = mafl
|
333
|
-
end
|
334
|
-
end
|
335
|
-
|
336
|
-
hash["hl.usePhraseHighlighter"] = @params[:highlighting][:use_phrase_highlighter]
|
337
|
-
|
338
|
-
regex = @params[:highlighting][:regex]
|
339
|
-
if regex
|
340
|
-
if regex[:slop]
|
341
|
-
if regex[:slop].kind_of? Hash
|
342
|
-
if regex[:slop][:default]
|
343
|
-
hash["hl.regex.slop"] = regex[:slop][:default]
|
344
|
-
end
|
345
|
-
if regex[:slop][:fields]
|
346
|
-
regex[:slop][:fields].each do |k,v|
|
347
|
-
hash["f.#{k}.hl.regex.slop"] = v
|
348
|
-
end
|
349
|
-
end
|
350
|
-
else
|
351
|
-
hash["hl.regex.slop"] = regex[:slop]
|
352
|
-
end
|
353
|
-
end
|
354
|
-
if regex[:pattern]
|
355
|
-
if regex[:pattern].kind_of? Hash
|
356
|
-
if regex[:pattern][:default]
|
357
|
-
hash["hl.regex.pattern"] = regex[:pattern][:default]
|
358
|
-
end
|
359
|
-
if regex[:pattern][:fields]
|
360
|
-
regex[:pattern][:fields].each do |k,v|
|
361
|
-
hash["f.#{k}.hl.regex.pattern"] = v
|
362
|
-
end
|
363
|
-
end
|
364
|
-
else
|
365
|
-
hash["hl.regex.pattern"] = regex[:pattern]
|
366
|
-
end
|
367
|
-
end
|
368
|
-
if regex[:max_analyzed_chars]
|
369
|
-
if regex[:max_analyzed_chars].kind_of? Hash
|
370
|
-
if regex[:max_analyzed_chars][:default]
|
371
|
-
hash["hl.regex.maxAnalyzedChars"] = regex[:max_analyzed_chars][:default]
|
372
|
-
end
|
373
|
-
if regex[:max_analyzed_chars][:fields]
|
374
|
-
regex[:max_analyzed_chars][:fields].each do |k,v|
|
375
|
-
hash["f.#{k}.hl.regex.maxAnalyzedChars"] = v
|
376
|
-
end
|
377
|
-
end
|
378
|
-
else
|
379
|
-
hash["hl.regex.maxAnalyzedChars"] = regex[:max_analyzed_chars]
|
380
|
-
end
|
381
|
-
end
|
382
|
-
end
|
383
|
-
|
384
|
-
end
|
385
|
-
|
386
|
-
if @params[:mlt]
|
387
|
-
hash[:mlt] = true
|
388
|
-
hash["mlt.count"] = @params[:mlt][:count]
|
389
|
-
hash["mlt.fl"] = @params[:mlt][:field_list].join(',')
|
390
|
-
hash["mlt.mintf"] = @params[:mlt][:min_term_freq]
|
391
|
-
hash["mlt.mindf"] = @params[:mlt][:min_doc_freq]
|
392
|
-
hash["mlt.minwl"] = @params[:mlt][:min_word_length]
|
393
|
-
hash["mlt.maxwl"] = @params[:mlt][:max_word_length]
|
394
|
-
hash["mlt.maxqt"] = @params[:mlt][:max_query_terms]
|
395
|
-
hash["mlt.maxntp"] = @params[:mlt][:max_tokens_parsed]
|
396
|
-
hash["mlt.boost"] = @params[:mlt][:boost]
|
397
|
-
end
|
398
|
-
|
399
|
-
hash.merge(super.to_hash)
|
400
|
-
end
|
401
|
-
|
402
|
-
end
|
data/lib/solr/request/update.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# The ASF licenses this file to You under the Apache License, Version 2.0
|
2
|
-
# (the "License"); you may not use this file except in compliance with
|
3
|
-
# the License. You may obtain a copy of the License at
|
4
|
-
#
|
5
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
6
|
-
#
|
7
|
-
# Unless required by applicable law or agreed to in writing, software
|
8
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
-
# See the License for the specific language governing permissions and
|
11
|
-
# limitations under the License.
|
12
|
-
|
13
|
-
# a parent class for all requests that go through the solr update handler
|
14
|
-
# TODO: Use new xml update handler for better error responses
|
15
|
-
class Solr::Request::Update < Solr::Request::Base
|
16
|
-
def response_format
|
17
|
-
:xml
|
18
|
-
end
|
19
|
-
|
20
|
-
def handler
|
21
|
-
'update'
|
22
|
-
end
|
23
|
-
end
|
data/lib/solr/response.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# The ASF licenses this file to You under the Apache License, Version 2.0
|
2
|
-
# (the "License"); you may not use this file except in compliance with
|
3
|
-
# the License. You may obtain a copy of the License at
|
4
|
-
#
|
5
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
6
|
-
#
|
7
|
-
# Unless required by applicable law or agreed to in writing, software
|
8
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
-
# See the License for the specific language governing permissions and
|
11
|
-
# limitations under the License.
|
12
|
-
|
13
|
-
module Solr; module Response; end; end
|
14
|
-
require 'solr/response/base'
|
15
|
-
require 'solr/response/xml'
|
16
|
-
require 'solr/response/ruby'
|
17
|
-
require 'solr/response/ping'
|
18
|
-
require 'solr/response/add_document'
|
19
|
-
require 'solr/response/modify_document'
|
20
|
-
require 'solr/response/standard'
|
21
|
-
require 'solr/response/spellcheck'
|
22
|
-
require 'solr/response/dismax'
|
23
|
-
require 'solr/response/commit'
|
24
|
-
require 'solr/response/delete'
|
25
|
-
require 'solr/response/index_info'
|
26
|
-
require 'solr/response/optimize'
|
27
|
-
require 'solr/response/select'
|