Commit 83b2a192ae2dab468358ab4718eebd75e2a8643e

Authored by Rafael Martins
1 parent 3fbcccd5

Get last version of acts_as_solr_reloaded

Changelog at git@github.com:brauliobo/acts_as_solr_reloaded.git
Showing 40 changed files with 2269 additions and 1380 deletions   Show diff stats
vendor/plugins/acts_as_solr_reloaded/.gitignore
  1 +# inside solr
  2 +solr/LICENSE.txt
  3 +solr/NOTICE.txt
  4 +solr/README.txt
  5 +solr/etc/
  6 +solr/work/
  7 +solr/lib/
  8 +solr/solr/README.txt
  9 +solr/solr/solr.xml
  10 +solr/start.jar
  11 +solr/webapps/
  12 +solr/solr/data/*
  13 +
  14 +acts_as_solr_reloaded-*.gem
1 *.log 15 *.log
2 *.log 16 *.log
3 *_pid 17 *_pid
  18 +
  19 +coverage
4 coverage/* 20 coverage/*
5 coverage.data 21 coverage.data
6 -solr/solr/data/*  
7 -.svn  
8 test/db/*.db 22 test/db/*.db
9 test/log/*.log 23 test/log/*.log
10 pkg/* 24 pkg/*
11 *.sw? 25 *.sw?
12 -.DS_Store  
13 -coverage  
14 rdoc 26 rdoc
15 pkg 27 pkg
16 -acts_as_solr_reloaded-*.gem  
17 tags 28 tags
  29 +.svn
vendor/plugins/acts_as_solr_reloaded/README.markdown
@@ -13,19 +13,20 @@ Install as a plugin @@ -13,19 +13,20 @@ Install as a plugin
13 13
14 script/plugin install git://github.com/brauliobo/acts_as_solr_reloaded.git 14 script/plugin install git://github.com/brauliobo/acts_as_solr_reloaded.git
15 15
16 -Download Solr 3.1 16 +Download Solr 3.5
17 17
18 rake solr:download 18 rake solr:download
19 19
20 Requirements 20 Requirements
21 ------ 21 ------
22 -* Java Runtime Environment(JRE) 1.6 aka 6.0 or newer [http://www.java.com/en/download/index.jsp](http://www.java.com/en/download/index.jsp) (use default-jre for Debian like distribution)  
23 -* (Recommended) If you have libxml-ruby installed, make sure it's at least version 0.7 22 +* Java Runtime Environment(JRE) 6.0 (or newer) from Oracle or OpenJDK
24 23
25 Configuration 24 Configuration
26 ====== 25 ======
27 See config/solr.yml file. 26 See config/solr.yml file.
28 27
  28 +For solr configuration the important files are solrconfig.xml and schema.xml.
  29 +
29 Basic Usage 30 Basic Usage
30 ====== 31 ======
31 <pre><code> 32 <pre><code>
@@ -42,13 +43,21 @@ Basic Usage @@ -42,13 +43,21 @@ Basic Usage
42 43
43 </code></pre> 44 </code></pre>
44 45
  46 +Pagination
  47 +======
  48 +ActsAsSolr implements in SearchResults class an interface compatible with will_paginate and maybe others.
45 49
46 -`acts_as_solr` in your tests 50 +In your tests
47 ====== 51 ======
48 -To test code that uses `acts_as_solr` you must start a Solr server for the test environment. You can do that with `rake solr:start RAILS_ENV=test` 52 +To test code that uses `acts_as_solr` you must start a Solr server for the test environment.
  53 +You can add to the beggining of your test/test_helper.rb the code:
  54 +<pre><code>
  55 +ENV["RAILS_ENV"] = "test"
  56 +abort unless system 'rake solr:start'
  57 +at_exit { system 'rake solr:stop' }
  58 +</pre></code>
49 59
50 However, if you would like to mock out Solr calls so that a Solr server is not needed (and your tests will run much faster), just add this to your `test_helper.rb` or similar: 60 However, if you would like to mock out Solr calls so that a Solr server is not needed (and your tests will run much faster), just add this to your `test_helper.rb` or similar:
51 -  
52 <pre><code> 61 <pre><code>
53 class ActsAsSolr::Post 62 class ActsAsSolr::Post
54 def self.execute(request) 63 def self.execute(request)
@@ -57,8 +66,6 @@ class ActsAsSolr::Post @@ -57,8 +66,6 @@ class ActsAsSolr::Post
57 end 66 end
58 </pre></code> 67 </pre></code>
59 68
60 -([via](http://www.subelsky.com/2007/10/actsassolr-capistranhttpwwwbloggercomim.html#c1646308013209805416))  
61 -  
62 Release Information 69 Release Information
63 ====== 70 ======
64 Released under the MIT license. 71 Released under the MIT license.
vendor/plugins/acts_as_solr_reloaded/README.rdoc
@@ -1,96 +0,0 @@ @@ -1,96 +0,0 @@
1 -= DESCRIPTION  
2 -  
3 -This plugin adds full text search capabilities and many other nifty features from Apache's Solr[http://lucene.apache.org/solr/] to any Rails model, like:  
4 -  
5 -* faceting  
6 -* dynamic attributes  
7 -* integration with acts_as_taggable_on  
8 -* integration with will_paginate  
9 -* highlighting  
10 -* geolocation  
11 -* relevance  
12 -* suggest  
13 -  
14 -Watch this screencast for a short demo of the latests features:  
15 -  
16 -http://www.vimeo.com/8728276  
17 -  
18 -== INSTALLATION  
19 -  
20 - script/plugin install git://github.com/brauliobo/acts_as_solr_reloaded.git  
21 - rake solr:download  
22 -  
23 -== REQUIREMENTS  
24 -  
25 -* Java Runtime Environment(JRE) 1.5 aka 5.0 [http://www.java.com/en/download/index.jsp](http://www.java.com/en/download/index.jsp) (use default-jre for Debian like distribution)  
26 -* (Recommended) If you have libxml-ruby installed, make sure it's at least version 0.7  
27 -  
28 -== CONFIGURATION  
29 -  
30 -See config/solr.yml file.  
31 -  
32 -== USAGE  
33 -  
34 -Just include the line below to any of your ActiveRecord models:  
35 - acts_as_solr  
36 -  
37 -Or if you want, you can specify only the fields that should be indexed:  
38 - acts_as_solr :fields => [:name, :author]  
39 -  
40 -Then to find instances of your model, just do:  
41 - Model.search(query) #query is a string representing your query  
42 -  
43 -Case you want to use dynamic attributes or geolocalization, you can use this generators that setup the database:  
44 -  
45 - script/generate dynamic_attributes_migration  
46 - script/generate local_migration  
47 -  
48 -and then configure your model like this:  
49 -  
50 - acts_as_solr :dynamic_attributes => true,  
51 - :spatial => true  
52 -  
53 -If you want to integrate the model with acts_as_taggable_on, just add the option :taggable => true :  
54 -  
55 - acts_as_solr :taggable => true  
56 -  
57 -Please see ActsAsSolr::ActsMethods for a complete info  
58 -  
59 -== PAGINATION  
60 -  
61 -In your controller:  
62 -  
63 - @search = Product.search "beer", :page => 2, :per_page => 20  
64 -  
65 -And in your view:  
66 -  
67 - will_paginate @search  
68 -  
69 -== TESTING  
70 -  
71 -To test code that uses acts_as_solr_reloaded you must start a Solr server for the test environment and also start MongoDB.  
72 -  
73 -== LICENSE  
74 -  
75 -(The MIT License)  
76 -  
77 -Copyright © 2010  
78 -  
79 -Permission is hereby granted, free of charge, to any person obtaining  
80 -a copy of this software and associated documentation files (the  
81 -‘Software’), to deal in the Software without restriction, including  
82 -without limitation the rights to use, copy, modify, merge, publish,  
83 -distribute, sublicense, and/or sell copies of the Software, and to  
84 -permit persons to whom the Software is furnished to do so, subject to  
85 -the following conditions:  
86 -  
87 -The above copyright notice and this permission notice shall be  
88 -included in all copies or substantial portions of the Software.  
89 -  
90 -THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND,  
91 -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF  
92 -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  
93 -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  
94 -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  
95 -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE  
96 -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
vendor/plugins/acts_as_solr_reloaded/config/solr.yml
1 -# Config file for the acts_as_solr_reloaded plugin. 1 +# Config file for the acts_as_solr plugin.
2 # 2 #
3 # If you change the host or port number here, make sure you update 3 # If you change the host or port number here, make sure you update
4 # them in your Solr config file 4 # them in your Solr config file
5 5
6 development: 6 development:
7 - url: http://127.0.0.1:8982/solr  
8 -  
9 -test:  
10 - url: http://127.0.0.1:8981/solr 7 + url: http://0.0.0.0:8982/solr
  8 + jvm_options: -server -Xmx128M -Xms16M
  9 + timeout: 0
11 10
12 production: 11 production:
13 url: http://127.0.0.1:8983/solr 12 url: http://127.0.0.1:8983/solr
14 - jvm_options: -server -d64 -Xmx1024M -Xms64M  
15 \ No newline at end of file 13 \ No newline at end of file
  14 + jvm_options: -server -Xmx192M -Xms64M
  15 + timeout: 0
  16 +
  17 +test: &TEST
  18 + url: http://0.0.0.0:8981/solr
  19 + jvm_options: -server -Xmx128M -Xms16M
  20 + timeout: 0
  21 +
  22 +cucumber:
  23 + <<: *TEST
vendor/plugins/acts_as_solr_reloaded/config/solr_environment.rb
@@ -27,7 +27,7 @@ end @@ -27,7 +27,7 @@ end
27 27
28 unless defined? SOLR_PORT 28 unless defined? SOLR_PORT
29 config = YAML::load_file(RAILS_ROOT+'/config/solr.yml') 29 config = YAML::load_file(RAILS_ROOT+'/config/solr.yml')
30 - raise("No solr environment defined for RAILS_ENV the #{ENV['RAILS_ENV'].inspect}") unless config[ENV['RAILS_ENV']] 30 + raise("No solr environment defined for RAILS_ENV = #{ENV['RAILS_ENV'].inspect}") unless config[ENV['RAILS_ENV']]
31 31
32 SOLR_HOST = ENV['HOST'] || URI.parse(config[ENV['RAILS_ENV']]['url']).host 32 SOLR_HOST = ENV['HOST'] || URI.parse(config[ENV['RAILS_ENV']]['url']).host
33 SOLR_PORT = ENV['PORT'] || URI.parse(config[ENV['RAILS_ENV']]['url']).port 33 SOLR_PORT = ENV['PORT'] || URI.parse(config[ENV['RAILS_ENV']]['url']).port
vendor/plugins/acts_as_solr_reloaded/lib/acts_as_solr.rb
@@ -19,36 +19,7 @@ require File.dirname(__FILE__) + &#39;/acts_as_solr/deprecation&#39; @@ -19,36 +19,7 @@ require File.dirname(__FILE__) + &#39;/acts_as_solr/deprecation&#39;
19 require File.dirname(__FILE__) + '/acts_as_solr/search_results' 19 require File.dirname(__FILE__) + '/acts_as_solr/search_results'
20 require File.dirname(__FILE__) + '/acts_as_solr/lazy_document' 20 require File.dirname(__FILE__) + '/acts_as_solr/lazy_document'
21 require File.dirname(__FILE__) + '/acts_as_solr/mongo_mapper' 21 require File.dirname(__FILE__) + '/acts_as_solr/mongo_mapper'
22 -  
23 -module ActsAsSolr  
24 - class Post  
25 - class << self  
26 - def config  
27 - return @config if @config  
28 - @config = {}  
29 - YAML::load_file("#{Rails.root}/config/solr.yml")[Rails.env].each{ |k,v| @config[k.to_sym] = v }  
30 - @config  
31 - end  
32 -  
33 - def options  
34 - @options ||= credentials.merge config  
35 - end  
36 -  
37 - def credentials  
38 - @credentials ||= {:username => config[:username], :password => config[:password]}  
39 - end  
40 -  
41 - def url(core)  
42 - core.nil? ? config[:url] : "#{config[:url]}/#{core}"  
43 - end  
44 -  
45 - def execute(request, core = nil)  
46 - connection = Solr::Connection.new(url(core), options)  
47 - connection.send request  
48 - end  
49 - end  
50 - end  
51 -end 22 +require File.dirname(__FILE__) + '/acts_as_solr/post'
52 23
53 # reopen ActiveRecord and include the acts_as_solr method 24 # reopen ActiveRecord and include the acts_as_solr method
54 ActiveRecord::Base.extend ActsAsSolr::ActsMethods 25 ActiveRecord::Base.extend ActsAsSolr::ActsMethods
vendor/plugins/acts_as_solr_reloaded/lib/acts_as_solr/acts_methods.rb
@@ -164,8 +164,11 @@ module ActsAsSolr #:nodoc: @@ -164,8 +164,11 @@ module ActsAsSolr #:nodoc:
164 # dynamic_attributes: Default false. When true, requires a has_many relationship to a DynamicAttribute 164 # dynamic_attributes: Default false. When true, requires a has_many relationship to a DynamicAttribute
165 # (:name, :value) model. Then, all dynamic attributes will be mapped as normal attributes 165 # (:name, :value) model. Then, all dynamic attributes will be mapped as normal attributes
166 # in Solr, so you can filter like this: Model.find_by_solr "#{dynamic_attribute.name}:Lorem" 166 # in Solr, so you can filter like this: Model.find_by_solr "#{dynamic_attribute.name}:Lorem"
  167 + #
167 # taggable: Default false. When true, indexes tags with field name tag. Tags are taken from taggings.tag 168 # taggable: Default false. When true, indexes tags with field name tag. Tags are taken from taggings.tag
  169 + #
168 # spatial: Default false. When true, indexes model.local.latitude and model.local.longitude as coordinates. 170 # spatial: Default false. When true, indexes model.local.latitude and model.local.longitude as coordinates.
  171 + #
169 def acts_as_solr(options={}, solr_options={}, &deferred_solr_configuration) 172 def acts_as_solr(options={}, solr_options={}, &deferred_solr_configuration)
170 173
171 $solr_indexed_models << self 174 $solr_indexed_models << self
@@ -262,20 +265,23 @@ module ActsAsSolr #:nodoc: @@ -262,20 +265,23 @@ module ActsAsSolr #:nodoc:
262 :additional_fields => nil, 265 :additional_fields => nil,
263 :dynamic_attributes => false, 266 :dynamic_attributes => false,
264 :exclude_fields => [], 267 :exclude_fields => [],
265 - :auto_commit => true, 268 + :auto_commit => ['production'].include?(Rails.env) ? false : true,
266 :include => nil, 269 :include => nil,
267 :facets => nil, 270 :facets => nil,
268 :boost => nil, 271 :boost => nil,
269 :if => "true", 272 :if => "true",
270 :offline => false, 273 :offline => false,
271 - :spatial => false 274 + :spatial => false,
272 } 275 }
273 self.solr_configuration = { 276 self.solr_configuration = {
274 :type_field => "type_s", 277 :type_field => "type_s",
275 :primary_key_field => "pk_s", 278 :primary_key_field => "pk_s",
276 - :default_boost => 1.0 279 + :default_boost => 1.0,
277 } 280 }
278 281
  282 + raise "Invalid options: #{(options.keys-configuration.keys).join(',')}" unless (options.keys-configuration.keys).empty?
  283 + raise "Invalid solr options: #{(solr_options.keys-solr_configuration.keys).join(',')}" unless (solr_options.keys-solr_configuration.keys).empty?
  284 +
279 configuration.update(options) if options.is_a?(Hash) 285 configuration.update(options) if options.is_a?(Hash)
280 solr_configuration.update(solr_options) if solr_options.is_a?(Hash) 286 solr_configuration.update(solr_options) if solr_options.is_a?(Hash)
281 Deprecation.validate_index(configuration) 287 Deprecation.validate_index(configuration)
@@ -290,8 +296,18 @@ module ActsAsSolr #:nodoc: @@ -290,8 +296,18 @@ module ActsAsSolr #:nodoc:
290 process_fields(configuration[:additional_fields]) 296 process_fields(configuration[:additional_fields])
291 end 297 end
292 298
293 - if configuration[:include].respond_to?(:each)  
294 - process_includes(configuration[:include]) 299 + process_includes(configuration[:include]) if configuration[:include]
  300 + end
  301 +
  302 + def after_save_reindex(associations, options = {})
  303 + Array(associations).each do |association|
  304 + after_save do |ar|
  305 + if options[:with] == :delayed_job
  306 + delay(:run_at => (Date.today+1.day).to_time+4.hours).solr_batch_add_association ar, association
  307 + else
  308 + solr_batch_add_association ar, association
  309 + end
  310 + end
295 end 311 end
296 end 312 end
297 313
@@ -301,19 +317,13 @@ module ActsAsSolr #:nodoc: @@ -301,19 +317,13 @@ module ActsAsSolr #:nodoc:
301 field_name, options = determine_field_name_and_options(field) 317 field_name, options = determine_field_name_and_options(field)
302 configuration[:solr_fields][field_name] = options 318 configuration[:solr_fields][field_name] = options
303 319
304 - define_method("#{field_name}_for_solr".to_sym) do  
305 - begin  
306 - value = self[field_name] || self.instance_variable_get("@#{field_name.to_s}".to_sym) || self.send(field_name.to_sym)  
307 - case options[:type]  
308 - # format dates properly; return nil for nil dates  
309 - when :date  
310 - value ? (value.respond_to?(:utc) ? value.utc : value).strftime("%Y-%m-%dT%H:%M:%SZ") : nil  
311 - else value  
312 - end  
313 - rescue  
314 - puts $!  
315 - logger.debug "There was a problem getting the value for the field '#{field_name}': #{$!}"  
316 - value = '' 320 + define_method "#{field_name}_for_solr" do
  321 + value = self.send field_name
  322 + case options[:type]
  323 + when :date # format dates properly; return nil for nil dates
  324 + value ? (value.respond_to?(:utc) ? value.utc : value).strftime("%Y-%m-%dT%H:%M:%SZ") : nil
  325 + else
  326 + value
317 end 327 end
318 end 328 end
319 end 329 end
@@ -328,11 +338,9 @@ module ActsAsSolr #:nodoc: @@ -328,11 +338,9 @@ module ActsAsSolr #:nodoc:
328 end 338 end
329 339
330 def process_includes(includes) 340 def process_includes(includes)
331 - if includes.respond_to?(:each)  
332 - includes.each do |assoc|  
333 - field_name, options = determine_field_name_and_options(assoc)  
334 - configuration[:solr_includes][field_name] = options  
335 - end 341 + Array(includes).each do |assoc|
  342 + field_name, options = determine_field_name_and_options(assoc)
  343 + configuration[:solr_includes][field_name] = options
336 end 344 end
337 end 345 end
338 346
vendor/plugins/acts_as_solr_reloaded/lib/acts_as_solr/class_methods.rb
@@ -197,7 +197,7 @@ module ActsAsSolr #:nodoc: @@ -197,7 +197,7 @@ module ActsAsSolr #:nodoc:
197 data = parse_query(query, options) 197 data = parse_query(query, options)
198 data.total_hits 198 data.total_hits
199 end 199 end
200 - 200 +
201 # It's used to rebuild the Solr index for a specific model. 201 # It's used to rebuild the Solr index for a specific model.
202 # Book.rebuild_solr_index 202 # Book.rebuild_solr_index
203 # 203 #
@@ -209,39 +209,75 @@ module ActsAsSolr #:nodoc: @@ -209,39 +209,75 @@ module ActsAsSolr #:nodoc:
209 # If a finder block is given, it will be called to retrieve the items to index. 209 # If a finder block is given, it will be called to retrieve the items to index.
210 # This can be very useful for things such as updating based on conditions or 210 # This can be very useful for things such as updating based on conditions or
211 # using eager loading for indexed associations. 211 # using eager loading for indexed associations.
212 - def rebuild_solr_index(batch_size=100, options = {}, &finder)  
213 - finder ||= lambda { |ar, options| ar.find(:all, options.merge({:order => self.primary_key})) } 212 + def rebuild_solr_index(batch_size=300, options = {}, &finder)
  213 + finder ||= lambda do |ar, sql_options|
  214 + ar.all sql_options.merge!({:order => self.primary_key, :include => configuration[:solr_includes].keys})
  215 + end
214 start_time = Time.now 216 start_time = Time.now
215 options[:offset] ||= 0 217 options[:offset] ||= 0
  218 + options[:threads] ||= 2
  219 + options[:delayed_job] &= defined?(Delayed::Job)
216 220
217 if batch_size > 0 221 if batch_size > 0
218 items_processed = 0 222 items_processed = 0
219 - limit = batch_size  
220 offset = options[:offset] 223 offset = options[:offset]
221 - begin  
222 - iteration_start = Time.now  
223 - items = finder.call(self, {:limit => limit, :offset => offset}) 224 + end_reached = false
  225 + threads = []
  226 + mutex = Mutex.new
  227 + queue = Queue.new
  228 + loop do
  229 + items = finder.call(self, {:limit => batch_size, :offset => offset})
224 add_batch = items.collect { |content| content.to_solr_doc } 230 add_batch = items.collect { |content| content.to_solr_doc }
225 -  
226 - if items.size > 0  
227 - solr_add add_batch  
228 - solr_commit  
229 - end  
230 -  
231 - items_processed += items.size  
232 - last_id = items.last.id if items.last  
233 - time_so_far = Time.now - start_time  
234 - iteration_time = Time.now - iteration_start  
235 - logger.info "#{Process.pid}: #{items_processed} items for #{self.name} have been batch added to index in #{'%.3f' % time_so_far}s at #{'%.3f' % (items_processed / time_so_far)} items/sec (#{'%.3f' % (items.size / iteration_time)} items/sec for the last batch). Last id: #{last_id}"  
236 offset += items.size 231 offset += items.size
237 - end while items.nil? || items.size > 0 232 + end_reached = items.size == 0
  233 + break if end_reached
  234 +
  235 + if options[:threads] == threads.size
  236 + threads.first.join
  237 + threads.shift
  238 + end
  239 +
  240 + queue << [items, add_batch]
  241 + threads << Thread.new do
  242 + iteration_start = Time.now
  243 +
  244 + iteration_items, iteration_add_batch = queue.pop(true)
  245 + if options[:delayed_job]
  246 + delay.solr_add iteration_add_batch
  247 + else
  248 + solr_add iteration_add_batch
  249 + solr_commit
  250 + end
  251 +
  252 + last_id = iteration_items.last.id
  253 + time_so_far = Time.now - start_time
  254 + iteration_time = Time.now - iteration_start
  255 + mutex.synchronize do
  256 + items_processed += iteration_items.size
  257 + if options[:delayed_job]
  258 + logger.info "#{Process.pid}: #{items_processed} items for #{self.name} have been sent to Delayed::Job in #{'%.3f' % time_so_far}s at #{'%.3f' % (items_processed / time_so_far)} items/sec. Last id: #{last_id}"
  259 + else
  260 + logger.info "#{Process.pid}: #{items_processed} items for #{self.name} have been batch added to index in #{'%.3f' % time_so_far}s at #{'%.3f' % (items_processed / time_so_far)} items/sec. Last id: #{last_id}"
  261 + end
  262 + end
  263 + end
  264 + end
  265 +
  266 + solr_commit if options[:delayed_job]
  267 + threads.each{ |t| t.join }
238 else 268 else
239 items = finder.call(self, {}) 269 items = finder.call(self, {})
240 items.each { |content| content.solr_save } 270 items.each { |content| content.solr_save }
241 items_processed = items.size 271 items_processed = items.size
242 end 272 end
243 - solr_optimize  
244 - logger.info items_processed > 0 ? "Index for #{self.name} has been rebuilt" : "Nothing to index for #{self.name}" 273 +
  274 + if items_processed > 0
  275 + solr_optimize
  276 + time_elapsed = Time.now - start_time
  277 + logger.info "Index for #{self.name} has been rebuilt (took #{'%.3f' % time_elapsed}s)"
  278 + else
  279 + "Nothing to index for #{self.name}"
  280 + end
245 end 281 end
246 282
247 alias :rebuild_index :rebuild_solr_index 283 alias :rebuild_index :rebuild_solr_index
vendor/plugins/acts_as_solr_reloaded/lib/acts_as_solr/common_methods.rb
1 module ActsAsSolr #:nodoc: 1 module ActsAsSolr #:nodoc:
2 2
3 module CommonMethods 3 module CommonMethods
4 - 4 +
  5 + TypeMapping = {
  6 + :double => "do",
  7 + :float => "f",
  8 + :decimal => "f",
  9 + :integer => "i",
  10 + :boolean => "b",
  11 + :string => "s",
  12 + :date => "d",
  13 + :range_float => "rf",
  14 + :range_integer => "ri",
  15 + :facet => "facet",
  16 + :text => "t",
  17 + }
  18 +
5 # Converts field types into Solr types 19 # Converts field types into Solr types
6 def get_solr_field_type(field_type) 20 def get_solr_field_type(field_type)
7 if field_type.is_a?(Symbol) 21 if field_type.is_a?(Symbol)
8 - h = {  
9 - :float => "f",  
10 - :decimal => "f",  
11 - :integer => "i",  
12 - :boolean => "b",  
13 - :string => "s",  
14 - :date => "d",  
15 - :range_float => "rf",  
16 - :range_integer => "ri",  
17 - :facet => "facet",  
18 - :text => "t",  
19 - }  
20 - t = h[field_type] 22 + t = TypeMapping[field_type]
21 raise "Unknown field_type symbol: #{field_type}" if t.nil? 23 raise "Unknown field_type symbol: #{field_type}" if t.nil?
22 t 24 t
23 elsif field_type.is_a?(String) 25 elsif field_type.is_a?(String)
@@ -34,7 +36,7 @@ module ActsAsSolr #:nodoc: @@ -34,7 +36,7 @@ module ActsAsSolr #:nodoc:
34 return "false" 36 return "false"
35 when "s", "t", "d", :date, :string, :text 37 when "s", "t", "d", :date, :string, :text
36 return "" 38 return ""
37 - when "f", "rf", :float, :range_float 39 + when "f", "rf", :float, :range_float, :double, :decimal
38 return 0.00 40 return 0.00
39 when "i", "ri", :integer, :range_integer 41 when "i", "ri", :integer, :range_integer
40 return 0 42 return 0
@@ -42,6 +44,14 @@ module ActsAsSolr #:nodoc: @@ -42,6 +44,14 @@ module ActsAsSolr #:nodoc:
42 return "" 44 return ""
43 end 45 end
44 end 46 end
  47 +
  48 + def solr_batch_add(objects)
  49 + solr_add Array(objects).map{ |a| a.to_solr_doc }
  50 + end
  51 +
  52 + def solr_batch_add_association(ar, association)
  53 + solr_batch_add ar.send(association)
  54 + end
45 55
46 # Sends an add command to Solr 56 # Sends an add command to Solr
47 def solr_add(add_xml) 57 def solr_add(add_xml)
vendor/plugins/acts_as_solr_reloaded/lib/acts_as_solr/deprecation.rb
@@ -30,7 +30,7 @@ module ActsAsSolr #:nodoc: @@ -30,7 +30,7 @@ module ActsAsSolr #:nodoc:
30 end 30 end
31 if options[:sort_by] 31 if options[:sort_by]
32 plog "The option :sort_by is deprecated, use :order instead!" 32 plog "The option :sort_by is deprecated, use :order instead!"
33 - options[:order] ||= options[:sort_by] 33 + options[:sort] ||= options[:sort_by]
34 end 34 end
35 if options[:start] 35 if options[:start]
36 plog "The option :start is deprecated, use :offset instead!" 36 plog "The option :start is deprecated, use :offset instead!"
vendor/plugins/acts_as_solr_reloaded/lib/acts_as_solr/instance_methods.rb
@@ -45,8 +45,6 @@ module ActsAsSolr #:nodoc: @@ -45,8 +45,6 @@ module ActsAsSolr #:nodoc:
45 45
46 # iterate through the fields and add them to the document, 46 # iterate through the fields and add them to the document,
47 configuration[:solr_fields].each do |field_name, options| 47 configuration[:solr_fields].each do |field_name, options|
48 - #field_type = configuration[:facets] && configuration[:facets].include?(field) ? :facet : :text  
49 -  
50 field_boost = options[:boost] || solr_configuration[:default_boost] 48 field_boost = options[:boost] || solr_configuration[:default_boost]
51 field_type = get_solr_field_type(options[:type]) 49 field_type = get_solr_field_type(options[:type])
52 solr_name = options[:as] || field_name 50 solr_name = options[:as] || field_name
@@ -66,8 +64,10 @@ module ActsAsSolr #:nodoc: @@ -66,8 +64,10 @@ module ActsAsSolr #:nodoc:
66 next if value.nil? || value.to_s.strip.empty? 64 next if value.nil? || value.to_s.strip.empty?
67 [value].flatten.each do |v| 65 [value].flatten.each do |v|
68 v = set_value_if_nil(suffix) if value.to_s == "" 66 v = set_value_if_nil(suffix) if value.to_s == ""
69 - field = Solr::Field.new("#{solr_name}_#{suffix}" => ERB::Util.html_escape(v.to_s))  
70 - field.boost = validate_boost(field_boost) 67 +
  68 + field = Solr::Field.new(:name => "#{solr_name}_#{suffix}", :value => ERB::Util.html_escape(v.to_s))
  69 + processed_boost = validate_boost(field_boost)
  70 + field.boost = processed_boost if processed_boost != solr_configuration[:default_boost]
71 doc << field 71 doc << field
72 end 72 end
73 end 73 end
@@ -78,38 +78,38 @@ module ActsAsSolr #:nodoc: @@ -78,38 +78,38 @@ module ActsAsSolr #:nodoc:
78 add_tags(doc) 78 add_tags(doc)
79 add_space(doc) 79 add_space(doc)
80 80
81 - debug doc.to_xml 81 + debug doc.to_json
82 doc 82 doc
83 end 83 end
84 - 84 +
85 private 85 private
86 86
87 def debug(text) 87 def debug(text)
88 logger.debug text rescue nil 88 logger.debug text rescue nil
89 end 89 end
90 - 90 +
91 def add_space(doc) 91 def add_space(doc)
92 if configuration[:spatial] and local 92 if configuration[:spatial] and local
93 - doc << Solr::Field.new("lat" => local.latitude)  
94 - doc << Solr::Field.new("lng" => local.longitude) 93 + doc << Solr::Field.new(:name => "lat", :value => local.latitude)
  94 + doc << Solr::Field.new(:name => "lng", :value => local.longitude)
95 end 95 end
96 end 96 end
97 97
98 def add_tags(doc) 98 def add_tags(doc)
99 taggings.each do |tagging| 99 taggings.each do |tagging|
100 - doc << Solr::Field.new("tag_facet" => tagging.tag.name)  
101 - doc << Solr::Field.new("tag_t" => tagging.tag.name) 100 + doc << Solr::Field.new(:name => "tag_facet", :value => tagging.tag.name)
  101 + doc << Solr::Field.new(:name => "tag_t", :value => tagging.tag.name)
102 end if configuration[:taggable] 102 end if configuration[:taggable]
103 end 103 end
104 104
105 def add_dynamic_attributes(doc) 105 def add_dynamic_attributes(doc)
106 dynamic_attributes.each do |attribute| 106 dynamic_attributes.each do |attribute|
107 value = ERB::Util.html_escape(attribute.value) 107 value = ERB::Util.html_escape(attribute.value)
108 - doc << Solr::Field.new("#{attribute.name}_t" => value)  
109 - doc << Solr::Field.new("#{attribute.name}_facet" => value) 108 + doc << Solr::Field.new(:name => "#{attribute.name}_t", :value => value)
  109 + doc << Solr::Field.new(:name => "#{attribute.name}_facet", :value => value)
110 end if configuration[:dynamic_attributes] 110 end if configuration[:dynamic_attributes]
111 end 111 end
112 - 112 +
113 def add_includes(doc) 113 def add_includes(doc)
114 if configuration[:solr_includes].respond_to?(:each) 114 if configuration[:solr_includes].respond_to?(:each)
115 configuration[:solr_includes].each do |association, options| 115 configuration[:solr_includes].each do |association, options|
@@ -120,12 +120,13 @@ module ActsAsSolr #:nodoc: @@ -120,12 +120,13 @@ module ActsAsSolr #:nodoc:
120 suffix = get_solr_field_type(field_type) 120 suffix = get_solr_field_type(field_type)
121 case self.class.reflect_on_association(association).macro 121 case self.class.reflect_on_association(association).macro
122 when :has_many, :has_and_belongs_to_many 122 when :has_many, :has_and_belongs_to_many
123 - records = self.send(association).to_a 123 + records = self.send(association).compact
124 unless records.empty? 124 unless records.empty?
125 records.each {|r| data << include_value(r, options)} 125 records.each {|r| data << include_value(r, options)}
126 - [data].flatten.each do |value|  
127 - field = Solr::Field.new("#{field_name}_#{suffix}" => value)  
128 - field.boost = validate_boost(field_boost) 126 + Array(data).each do |value|
  127 + field = Solr::Field.new(:name => "#{field_name}_#{suffix}", :value => value)
  128 + processed_boost = validate_boost(field_boost)
  129 + field.boost = processed_boost if processed_boost != solr_configuration[:default_boost]
129 doc << field 130 doc << field
130 end 131 end
131 end 132 end
@@ -145,7 +146,13 @@ module ActsAsSolr #:nodoc: @@ -145,7 +146,13 @@ module ActsAsSolr #:nodoc:
145 elsif options[:using].is_a? Symbol 146 elsif options[:using].is_a? Symbol
146 record.send(options[:using]) 147 record.send(options[:using])
147 else 148 else
148 - record.attributes.inject([]){|k,v| k << "#{v.first}=#{ERB::Util.html_escape(v.last)}"}.join(" ") 149 + if options[:fields]
  150 + fields = {}
  151 + options[:fields].each{ |f| fields[f] = record.send(f) }
  152 + else
  153 + fields = record.attributes
  154 + end
  155 + fields.map{ |k,v| ERB::Util.html_escape(v) }.join(" ")
149 end 156 end
150 end 157 end
151 158
vendor/plugins/acts_as_solr_reloaded/lib/acts_as_solr/parser_methods.rb
@@ -4,9 +4,10 @@ module ActsAsSolr #:nodoc: @@ -4,9 +4,10 @@ module ActsAsSolr #:nodoc:
4 4
5 # Method used by mostly all the ClassMethods when doing a search 5 # Method used by mostly all the ClassMethods when doing a search
6 def parse_query(query=nil, options={}, models=nil) 6 def parse_query(query=nil, options={}, models=nil)
7 - valid_options = [ :filter_queries, :offset, :limit, :facets, :models, :results_format, :order,  
8 - :scores, :operator, :include, :lazy, :joins, :select, :core,  
9 - :around, :relevance, :highlight, :page, :per_page] 7 + valid_options = [ :alternate_query, :boost_functions, :filter_queries, :facets, :models, :sort,
  8 + :scores, :operator, :lazy, :core, :latitude, :longitude, :radius, :relevance, :highlight,
  9 + :offset, :per_page, :limit, :page,
  10 + :results_format, :sql_options]
10 query_options = {} 11 query_options = {}
11 12
12 field_list = models.nil? ? solr_configuration[:primary_key_field] : "id" 13 field_list = models.nil? ? solr_configuration[:primary_key_field] : "id"
@@ -20,8 +21,7 @@ module ActsAsSolr #:nodoc: @@ -20,8 +21,7 @@ module ActsAsSolr #:nodoc:
20 query = sanitize_query(query) 21 query = sanitize_query(query)
21 query_options[:filter_queries].push(solr_type_condition) 22 query_options[:filter_queries].push(solr_type_condition)
22 end 23 end
23 - query_options[:query] = query  
24 - order = options[:order].split(/\s*,\s*/).collect{|e| e.gsub(/\s+/,'_t ').gsub(/\bscore_t\b/, 'score') }.join(',') if options[:order] 24 + query_options[:query] = "#{options[:alternate_query]} #{query}"
25 25
26 raise "Invalid parameters: #{(options.keys - valid_options).join(',')}" unless (options.keys - valid_options).empty? 26 raise "Invalid parameters: #{(options.keys - valid_options).join(',')}" unless (options.keys - valid_options).empty?
27 begin 27 begin
@@ -34,8 +34,8 @@ module ActsAsSolr #:nodoc: @@ -34,8 +34,8 @@ module ActsAsSolr #:nodoc:
34 34
35 query = add_relevance query, options[:relevance] 35 query = add_relevance query, options[:relevance]
36 36
37 - raise "Expecting and array of strings for :filter_queries" unless options[:filter_queries].nil? or options[:filter_queries].kind_of?(Array)  
38 - query_options[:filter_queries] += replace_types([*options[:filter_queries]].collect{|k| "#{k.dup.sub!(/ *: */,"_t:")}"}) if options[:filter_queries] 37 + query_options[:filter_queries] += replace_types([*options[:filter_queries]], '') if options[:filter_queries]
  38 + query_options[:boost_functions] = replace_types([*options[:boost_functions]], '').join(' ') if options[:boost_functions]
39 39
40 # first steps on the facet parameter processing 40 # first steps on the facet parameter processing
41 if options[:facets] 41 if options[:facets]
@@ -47,9 +47,8 @@ module ActsAsSolr #:nodoc: @@ -47,9 +47,8 @@ module ActsAsSolr #:nodoc:
47 # override the :zeros (it's deprecated anyway) if :mincount exists 47 # override the :zeros (it's deprecated anyway) if :mincount exists
48 query_options[:facets][:mincount] = options[:facets][:mincount] if options[:facets][:mincount] 48 query_options[:facets][:mincount] = options[:facets][:mincount] if options[:facets][:mincount]
49 query_options[:facets][:fields] = options[:facets][:fields].collect{|k| "#{k}_facet"} if options[:facets][:fields] 49 query_options[:facets][:fields] = options[:facets][:fields].collect{|k| "#{k}_facet"} if options[:facets][:fields]
50 - query_options[:filter_queries] += replace_types([*options[:facets][:browse]].collect{|k| "#{k.dup.sub!(/ *: */,"_t:")}"}) if options[:facets][:browse]  
51 - query_options[:facets][:queries] = replace_types(options[:facets][:query].collect{|k| "#{k.dup.sub!(/ *: */,"_t:")}"}) if options[:facets][:query]  
52 - 50 + query_options[:filter_queries] += replace_types([*options[:facets][:browse]]) if options[:facets][:browse]
  51 + query_options[:facets][:queries] = replace_types(options[:facets][:query]) if options[:facets][:query]
53 52
54 if options[:facets][:dates] 53 if options[:facets][:dates]
55 query_options[:date_facets] = {} 54 query_options[:date_facets] = {}
@@ -82,28 +81,25 @@ module ActsAsSolr #:nodoc: @@ -82,28 +81,25 @@ module ActsAsSolr #:nodoc:
82 end 81 end
83 end 82 end
84 83
85 - if options[:highlight]  
86 - query_options[:highlighting] = {}  
87 - query_options[:highlighting][:field_list] = []  
88 - query_options[:highlighting][:field_list] << options[:highlight][:fields].collect {|k| "#{k}_t"} if options[:highlight][:fields]  
89 - query_options[:highlighting][:require_field_match] = options[:highlight][:require_field_match] if options[:highlight][:require_field_match]  
90 - query_options[:highlighting][:max_snippets] = options[:highlight][:max_snippets] if options[:highlight][:max_snippets]  
91 - query_options[:highlighting][:prefix] = options[:highlight][:prefix] if options[:highlight][:prefix]  
92 - query_options[:highlighting][:suffix] = options[:highlight][:suffix] if options[:highlight][:suffix]  
93 - end  
94 -  
95 - # TODO: set the sort parameter instead of the old ;order. style.  
96 - query_options[:sort] = replace_types([order], false)[0] if options[:order]  
97 -  
98 - if options[:around]  
99 - query_options[:radius] = options[:around][:radius]  
100 - query_options[:latitude] = options[:around][:latitude]  
101 - query_options[:longitude] = options[:around][:longitude] 84 + if options[:highlight]
  85 + query_options[:highlighting] = {}
  86 + query_options[:highlighting][:field_list] = []
  87 + query_options[:highlighting][:field_list] << options[:highlight][:fields].collect {|k| "#{k}_t"} if options[:highlight][:fields]
  88 + query_options[:highlighting][:require_field_match] = options[:highlight][:require_field_match] if options[:highlight][:require_field_match]
  89 + query_options[:highlighting][:max_snippets] = options[:highlight][:max_snippets] if options[:highlight][:max_snippets]
  90 + query_options[:highlighting][:prefix] = options[:highlight][:prefix] if options[:highlight][:prefix]
  91 + query_options[:highlighting][:suffix] = options[:highlight][:suffix] if options[:highlight][:suffix]
102 end 92 end
103 93
104 - ActsAsSolr::Post.execute(Solr::Request::Standard.new(query_options), options[:core]) 94 + query_options[:sort] = replace_types([options[:sort]], '')[0] if options[:sort]
  95 +
  96 + query_options[:radius] = options[:radius]
  97 + query_options[:latitude] = options[:latitude]
  98 + query_options[:longitude] = options[:longitude]
  99 +
  100 + ActsAsSolr::Post.execute(Solr::Request::Dismax.new(query_options), options[:core])
105 rescue 101 rescue
106 - raise "There was a problem executing your search\n#{query_options.inspect}\n: #{$!} in #{$!.backtrace.first}" 102 + raise "#{$query} There was a problem executing your search\n#{query_options.inspect}\n: #{$!} in #{$!.backtrace.first}"
107 end 103 end
108 end 104 end
109 105
@@ -158,11 +154,11 @@ module ActsAsSolr #:nodoc: @@ -158,11 +154,11 @@ module ActsAsSolr #:nodoc:
158 result = if configuration[:lazy] && configuration[:format] != :ids 154 result = if configuration[:lazy] && configuration[:format] != :ids
159 ids.collect {|id| ActsAsSolr::LazyDocument.new(id, self)} 155 ids.collect {|id| ActsAsSolr::LazyDocument.new(id, self)}
160 elsif configuration[:format] == :objects 156 elsif configuration[:format] == :objects
161 - find_options = {}  
162 - find_options[:include] = options[:include] if options[:include]  
163 - find_options[:select] = options[:select] if options[:select]  
164 - find_options[:joins] = options[:joins] if options[:joins]  
165 - result = reorder(self.find(ids, find_options), ids) 157 + find_options = options[:sql_options] || {}
  158 + find_options[:conditions] = self.send :merge_conditions, {:id => ids}, (find_options[:conditions] || [])
  159 + result = self.all(find_options)
  160 + result = reorder(result, ids) unless find_options[:order]
  161 + result
166 else 162 else
167 ids 163 ids
168 end 164 end
@@ -182,14 +178,13 @@ module ActsAsSolr #:nodoc: @@ -182,14 +178,13 @@ module ActsAsSolr #:nodoc:
182 178
183 # Replaces the field types based on the types (if any) specified 179 # Replaces the field types based on the types (if any) specified
184 # on the acts_as_solr call 180 # on the acts_as_solr call
185 - def replace_types(strings, include_colon=true)  
186 - suffix = include_colon ? ":" : "" 181 + def replace_types(strings, suffix=':')
187 if configuration[:solr_fields] 182 if configuration[:solr_fields]
188 configuration[:solr_fields].each do |name, options| 183 configuration[:solr_fields].each do |name, options|
189 - solr_name = options[:as] || name.to_s 184 + solr_name = (options[:as] || name).to_s
190 solr_type = get_solr_field_type(options[:type]) 185 solr_type = get_solr_field_type(options[:type])
191 field = "#{solr_name}_#{solr_type}#{suffix}" 186 field = "#{solr_name}_#{solr_type}#{suffix}"
192 - strings.each_with_index {|s,i| strings[i] = s.gsub(/#{solr_name.to_s}_t#{suffix}/,field) } 187 + strings.each_with_index {|s,i| strings[i] = s.gsub(/\b#{solr_name}\b#{suffix}/,field) }
193 end 188 end
194 end 189 end
195 if configuration[:solr_includes] 190 if configuration[:solr_includes]
@@ -197,7 +192,7 @@ module ActsAsSolr #:nodoc: @@ -197,7 +192,7 @@ module ActsAsSolr #:nodoc:
197 solr_name = options[:as] || association.to_s.singularize 192 solr_name = options[:as] || association.to_s.singularize
198 solr_type = get_solr_field_type(options[:type]) 193 solr_type = get_solr_field_type(options[:type])
199 field = "#{solr_name}_#{solr_type}#{suffix}" 194 field = "#{solr_name}_#{solr_type}#{suffix}"
200 - strings.each_with_index {|s,i| strings[i] = s.gsub(/#{solr_name.to_s}_t#{suffix}/,field) } 195 + strings.each_with_index {|s,i| strings[i] = s.gsub(/\b#{solr_name}\b#{suffix}/,field) }
201 end 196 end
202 end 197 end
203 strings 198 strings
vendor/plugins/acts_as_solr_reloaded/lib/acts_as_solr/post.rb 0 → 100644
@@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
  1 +module ActsAsSolr
  2 + class Post
  3 + class << self
  4 + def config
  5 + return @config if @config
  6 + @config = {}
  7 + YAML::load_file("#{Rails.root}/config/solr.yml")[Rails.env].each{ |k,v| @config[k.to_sym] = v }
  8 + @config
  9 + end
  10 +
  11 + def options
  12 + @options ||= credentials.merge config
  13 + end
  14 +
  15 + def credentials
  16 + @credentials ||= {:username => config[:username], :password => config[:password]}
  17 + end
  18 +
  19 + def url(core)
  20 + core.nil? ? config[:url] : "#{config[:url]}/#{core}"
  21 + end
  22 +
  23 + def execute(request, core = nil)
  24 + connection = Solr::Connection.new(url(core), options)
  25 + connection.send request
  26 + end
  27 + end
  28 + end
  29 +end
vendor/plugins/acts_as_solr_reloaded/lib/acts_as_solr/search_results.rb
@@ -27,10 +27,17 @@ module ActsAsSolr #:nodoc: @@ -27,10 +27,17 @@ module ActsAsSolr #:nodoc:
27 # 27 #
28 # 28 #
29 class SearchResults 29 class SearchResults
  30 +
  31 + include Enumerable
  32 +
30 def initialize(solr_data={}) 33 def initialize(solr_data={})
31 @solr_data = solr_data 34 @solr_data = solr_data
32 end 35 end
33 36
  37 + def each(&block)
  38 + self.results.each &block
  39 + end
  40 +
34 # Returns an array with the instances. This method 41 # Returns an array with the instances. This method
35 # is also aliased as docs and records 42 # is also aliased as docs and records
36 def results 43 def results
@@ -60,7 +67,7 @@ module ActsAsSolr #:nodoc: @@ -60,7 +67,7 @@ module ActsAsSolr #:nodoc:
60 67
61 # Returns the highlighted fields which one has asked for.. 68 # Returns the highlighted fields which one has asked for..
62 def highlights 69 def highlights
63 - @solr_data[:highlights] 70 + @solr_data[:highlights]
64 end 71 end
65 72
66 # Returns a suggested query 73 # Returns a suggested query
@@ -83,10 +90,45 @@ module ActsAsSolr #:nodoc: @@ -83,10 +90,45 @@ module ActsAsSolr #:nodoc:
83 (@solr_data[:start].to_i / per_page) + 1 90 (@solr_data[:start].to_i / per_page) + 1
84 end 91 end
85 92
  93 + def blank?
  94 + total_entries == 0
  95 + end
  96 +
  97 + def size
  98 + total_entries
  99 + end
  100 +
  101 + def offset
  102 + (current_page - 1) * per_page
  103 + end
  104 +
  105 + def previous_page
  106 + if current_page > 1
  107 + current_page - 1
  108 + else
  109 + false
  110 + end
  111 + end
  112 +
  113 + def next_page
  114 + if current_page < total_pages
  115 + current_page + 1
  116 + else
  117 + false
  118 + end
  119 + end
  120 +
  121 + def method_missing(symbol, *args, &block)
  122 + self.results.send(symbol, *args, &block)
  123 + rescue NoMethodError
  124 + raise NoMethodError, "There is no method called #{symbol} at #{self.class.name} - #{self.inspect}"
  125 + end
  126 +
86 alias docs results 127 alias docs results
87 alias records results 128 alias records results
88 alias num_found total 129 alias num_found total
89 alias total_hits total 130 alias total_hits total
  131 + alias total_entries total
90 alias highest_score max_score 132 alias highest_score max_score
91 end 133 end
92 134
vendor/plugins/acts_as_solr_reloaded/lib/solr/connection.rb
@@ -40,8 +40,8 @@ class Solr::Connection @@ -40,8 +40,8 @@ class Solr::Connection
40 40
41 # Not actually opening the connection yet, just setting up the persistent connection. 41 # Not actually opening the connection yet, just setting up the persistent connection.
42 @connection = Net::HTTP.new(@url.host, @url.port) 42 @connection = Net::HTTP.new(@url.host, @url.port)
43 -  
44 - @connection.read_timeout = opts[:timeout] if opts[:timeout] 43 +
  44 + @connection.read_timeout = opts[:timeout].to_i || 0
45 @username = opts[:username] if opts[:username] 45 @username = opts[:username] if opts[:username]
46 @password = opts[:password] if opts[:password] 46 @password = opts[:password] if opts[:password]
47 end 47 end
vendor/plugins/acts_as_solr_reloaded/lib/solr/document.rb
@@ -18,7 +18,7 @@ class Solr::Document @@ -18,7 +18,7 @@ class Solr::Document
18 # Create a new Solr::Document, optionally passing in a hash of 18 # Create a new Solr::Document, optionally passing in a hash of
19 # key/value pairs for the fields 19 # key/value pairs for the fields
20 # 20 #
21 - # doc = Solr::Document.new(:creator => 'Jorge Luis Borges') 21 + # doc = Solr::Document.new(:name => :creator, :value => 'Jorge Luis Borges')
22 def initialize(hash={}) 22 def initialize(hash={})
23 @fields = [] 23 @fields = []
24 self << hash 24 self << hash
@@ -26,19 +26,19 @@ class Solr::Document @@ -26,19 +26,19 @@ class Solr::Document
26 26
27 # Append a Solr::Field 27 # Append a Solr::Field
28 # 28 #
29 - # doc << Solr::Field.new(:creator => 'Jorge Luis Borges') 29 + # doc << Solr::Field.new(:name => :creator, :value => 'Jorge Luis Borges')
30 # 30 #
31 # If you are truly lazy you can simply pass in a hash: 31 # If you are truly lazy you can simply pass in a hash:
32 # 32 #
33 - # doc << {:creator => 'Jorge Luis Borges'} 33 + # doc << {:name => :creator, :value => 'Jorge Luis Borges'}
34 def <<(fields) 34 def <<(fields)
35 case fields 35 case fields
36 when Hash 36 when Hash
37 fields.each_pair do |name,value| 37 fields.each_pair do |name,value|
38 if value.respond_to?(:each) && !value.is_a?(String) 38 if value.respond_to?(:each) && !value.is_a?(String)
39 - value.each {|v| @fields << Solr::Field.new(name => v)} 39 + value.each {|v| @fields << Solr::Field.new(:name => name, :value => v)}
40 else 40 else
41 - @fields << Solr::Field.new(name => value) 41 + @fields << Solr::Field.new(:name => name, :value => value)
42 end 42 end
43 end 43 end
44 when Solr::Field 44 when Solr::Field
@@ -58,10 +58,20 @@ class Solr::Document @@ -58,10 +58,20 @@ class Solr::Document
58 58
59 # shorthand to assign as a hash 59 # shorthand to assign as a hash
60 def []=(name,value) 60 def []=(name,value)
61 - @fields << Solr::Field.new(name => value) 61 + @fields << Solr::Field.new(:name => name, :value => value)
  62 + end
  63 +
  64 + def to_jsonhash
  65 + hash = {'doc' => {}}
  66 + hash['boost'] = @boost if @boost
  67 + @fields.each{ |f| hash['doc'][f.name] = f.value_to_jsonhash }
  68 + hash
  69 + end
  70 +
  71 + def to_json
  72 + to_jsonhash.to_json
62 end 73 end
63 74
64 - # convert the Document to a REXML::Element  
65 def to_xml 75 def to_xml
66 e = Solr::XML::Element.new 'doc' 76 e = Solr::XML::Element.new 'doc'
67 e.attributes['boost'] = @boost.to_s if @boost 77 e.attributes['boost'] = @boost.to_s if @boost
vendor/plugins/acts_as_solr_reloaded/lib/solr/field.rb
@@ -18,18 +18,22 @@ class Solr::Field @@ -18,18 +18,22 @@ class Solr::Field
18 18
19 # Accepts an optional <tt>:boost</tt> parameter, used to boost the relevance of a particular field. 19 # Accepts an optional <tt>:boost</tt> parameter, used to boost the relevance of a particular field.
20 def initialize(params) 20 def initialize(params)
21 - @boost = params[:boost]  
22 - name_key = (params.keys - VALID_PARAMS).first  
23 - @name, @value = name_key.to_s, params[name_key] 21 + @boost = params[:boost] == 1.0 ? nil : params[:boost]
  22 + @name = params[:name].to_s
  23 + @value = params[:value]
24 # Convert any Time values into UTC/XML schema format (which Solr requires). 24 # Convert any Time values into UTC/XML schema format (which Solr requires).
25 - @value = @value.respond_to?(:utc) ? @value.utc.xmlschema : @value.to_str 25 + @value = @value.respond_to?(:utc) ? @value.utc.xmlschema : @value
26 end 26 end
27 27
  28 + def value_to_jsonhash
  29 + @boost.nil? ? @value : {'boost' => @boost, 'value' => @value}
  30 + end
  31 +
28 def to_xml 32 def to_xml
29 e = Solr::XML::Element.new 'field' 33 e = Solr::XML::Element.new 'field'
30 e.attributes['name'] = @name 34 e.attributes['name'] = @name
31 e.attributes['boost'] = @boost.to_s if @boost 35 e.attributes['boost'] = @boost.to_s if @boost
32 - e.text = @value 36 + e.text = @value.to_str
33 return e 37 return e
34 end 38 end
35 39
vendor/plugins/acts_as_solr_reloaded/lib/solr/request/add_document.rb
@@ -10,19 +10,19 @@ @@ -10,19 +10,19 @@
10 # See the License for the specific language governing permissions and 10 # See the License for the specific language governing permissions and
11 # limitations under the License. 11 # limitations under the License.
12 12
13 -class Solr::Request::AddDocument < Solr::Request::Update 13 +class Solr::Request::AddDocument < Solr::Request::JsonUpdate
14 14
15 # create the request, optionally passing in a Solr::Document 15 # create the request, optionally passing in a Solr::Document
16 # 16 #
17 - # request = Solr::Request::AddDocument.new doc 17 + # request = Solr::Request::AddDocument.new(doc)
18 # 18 #
19 # as a short cut you can pass in a Hash instead: 19 # as a short cut you can pass in a Hash instead:
20 # 20 #
21 - # request = Solr::Request::AddDocument.new :creator => 'Jorge Luis Borges' 21 + # request = Solr::Request::AddDocument.new(:creator => 'Jorge Luis Borges')
22 # 22 #
23 # or an array, to add multiple documents at the same time: 23 # or an array, to add multiple documents at the same time:
24 # 24 #
25 - # request = Solr::Request::AddDocument.new([doc1, doc2, doc3]) 25 + # request = Solr::Request::AddDocument.new([doc1, doc2, doc3]))
26 26
27 def initialize(doc={}) 27 def initialize(doc={})
28 @docs = [] 28 @docs = []
@@ -33,15 +33,23 @@ class Solr::Request::AddDocument &lt; Solr::Request::Update @@ -33,15 +33,23 @@ class Solr::Request::AddDocument &lt; Solr::Request::Update
33 end 33 end
34 end 34 end
35 35
36 - # returns the request as a string suitable for posting  
37 -  
38 - def to_s 36 + def to_json
  37 + '{' +
  38 + @docs.map{ |doc| "\"add\": #{doc.to_jsonhash.to_json}" }.join(',') +
  39 + '}'
  40 + end
  41 +
  42 + def to_xml
39 e = Solr::XML::Element.new 'add' 43 e = Solr::XML::Element.new 'add'
40 for doc in @docs 44 for doc in @docs
41 e.add_element doc.to_xml 45 e.add_element doc.to_xml
42 end 46 end
43 return e.to_s 47 return e.to_s
44 end 48 end
  49 +
  50 + def to_s
  51 + to_json
  52 + end
45 53
46 private 54 private
47 def add_doc(doc) 55 def add_doc(doc)
vendor/plugins/acts_as_solr_reloaded/lib/solr/request/dismax.rb
@@ -13,34 +13,25 @@ @@ -13,34 +13,25 @@
13 class Solr::Request::Dismax < Solr::Request::Standard 13 class Solr::Request::Dismax < Solr::Request::Standard
14 14
15 VALID_PARAMS.replace(VALID_PARAMS + [:tie_breaker, :query_fields, :minimum_match, :phrase_fields, :phrase_slop, 15 VALID_PARAMS.replace(VALID_PARAMS + [:tie_breaker, :query_fields, :minimum_match, :phrase_fields, :phrase_slop,
16 - :boost_query, :boost_functions]) 16 + :alternate_query, :boost_query, :boost_functions])
17 17
18 def initialize(params) 18 def initialize(params)
19 - @alternate_query = params.delete(:alternate_query)  
20 - @sort_values = params.delete(:sort)  
21 -  
22 - super  
23 -  
24 - @query_type = "dismax" 19 + super("search")
25 end 20 end
26 21
27 def to_hash 22 def to_hash
28 hash = super 23 hash = super
  24 + hash[:defType] = 'edismax'
29 hash[:tie] = @params[:tie_breaker] 25 hash[:tie] = @params[:tie_breaker]
30 hash[:mm] = @params[:minimum_match] 26 hash[:mm] = @params[:minimum_match]
31 hash[:qf] = @params[:query_fields] 27 hash[:qf] = @params[:query_fields]
32 hash[:pf] = @params[:phrase_fields] 28 hash[:pf] = @params[:phrase_fields]
33 hash[:ps] = @params[:phrase_slop] 29 hash[:ps] = @params[:phrase_slop]
34 hash[:bq] = @params[:boost_query] 30 hash[:bq] = @params[:boost_query]
35 - hash[:bf] = @params[:boost_functions]  
36 - hash["q.alt"] = @alternate_query  
37 - # FIXME: 2007-02-13 <coda.hale@gmail.com> -- This code is duplicated in  
38 - # Solr::Request::Standard. It should be refactored into a single location.  
39 - hash[:sort] = @sort_values.collect do |sort|  
40 - key = sort.keys[0]  
41 - "#{key.to_s} #{sort[key] == :descending ? 'desc' : 'asc'}"  
42 - end.join(',') if @sort_values 31 + hash[:boost] = @params[:boost_functions]
  32 + hash["q.alt"] = @params[:alternate_query]
  33 +
43 return hash 34 return hash
44 end 35 end
45 36
46 -end  
47 \ No newline at end of file 37 \ No newline at end of file
  38 +end
vendor/plugins/acts_as_solr_reloaded/lib/solr/request/standard.rb
@@ -14,10 +14,10 @@ class Solr::Request::Standard &lt; Solr::Request::Select @@ -14,10 +14,10 @@ class Solr::Request::Standard &lt; Solr::Request::Select
14 14
15 VALID_PARAMS = [:query, :sort, :default_field, :operator, :start, :rows, :shards, :date_facets, 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, :radius, 16 :filter_queries, :field_list, :debug_query, :explain_other, :facets, :highlighting, :mlt, :radius,
17 - :latitude, :longitude, :spellcheck] 17 + :radius, :latitude, :longitude, :spellcheck]
18 18
19 def initialize(params) 19 def initialize(params)
20 - super(params[:radius].nil? ? 'standard' : 'geo') 20 + super('search')
21 21
22 raise "Invalid parameters: #{(params.keys - VALID_PARAMS).join(',')}" unless 22 raise "Invalid parameters: #{(params.keys - VALID_PARAMS).join(',')}" unless
23 (params.keys - VALID_PARAMS).empty? 23 (params.keys - VALID_PARAMS).empty?
@@ -51,6 +51,7 @@ class Solr::Request::Standard &lt; Solr::Request::Select @@ -51,6 +51,7 @@ class Solr::Request::Standard &lt; Solr::Request::Select
51 hash[:q] = @params[:query] 51 hash[:q] = @params[:query]
52 hash["q.op"] = @params[:operator] 52 hash["q.op"] = @params[:operator]
53 hash[:df] = @params[:default_field] 53 hash[:df] = @params[:default_field]
  54 + hash[:echoParams] = 'explicit'
54 55
55 # common parameter processing 56 # common parameter processing
56 hash[:start] = @params[:start] 57 hash[:start] = @params[:start]
@@ -61,11 +62,9 @@ class Solr::Request::Standard &lt; Solr::Request::Select @@ -61,11 +62,9 @@ class Solr::Request::Standard &lt; Solr::Request::Select
61 hash[:explainOther] = @params[:explain_other] 62 hash[:explainOther] = @params[:explain_other]
62 hash[:shards] = @params[:shards].join(',') unless @params[:shards].empty? 63 hash[:shards] = @params[:shards].join(',') unless @params[:shards].empty?
63 64
64 - #if @params[:qt].eql? 'geo'  
65 - hash[:radius] = @params[:radius]  
66 - hash[:lat] = @params[:latitude]  
67 - hash[:long] = @params[:longitude]  
68 - #end 65 + hash[:sfield] = 'latlng'
  66 + hash[:d] = @params[:radius]
  67 + hash[:pt] = "#{@params[:latitude]}, #{@params[:longitude]}"
69 68
70 # facet parameter processing 69 # facet parameter processing
71 if @params[:facets] 70 if @params[:facets]
vendor/plugins/acts_as_solr_reloaded/lib/solr/solrtasks.rb
@@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
1 -#!/usr/bin/env ruby  
2 -# The ASF licenses this file to You under the Apache License, Version 2.0  
3 -# (the "License"); you may not use this file except in compliance with  
4 -# the License. You may obtain a copy of the License at  
5 -#  
6 -# http://www.apache.org/licenses/LICENSE-2.0  
7 -#  
8 -# Unless required by applicable law or agreed to in writing, software  
9 -# distributed under the License is distributed on an "AS IS" BASIS,  
10 -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
11 -# See the License for the specific language governing permissions and  
12 -# limitations under the License.  
13 -  
14 -# TODO: fill out Solr tasks: start, stop, ping, optimize, etc.  
15 -  
16 -require 'rake'  
17 -require 'rake/tasklib'  
18 -  
19 -module Solr  
20 - namespace :solr do  
21 - desc "Start Solr"  
22 - task :start do  
23 - # TODO: actually start it up!  
24 - puts "Starting..."  
25 - end  
26 - end  
27 -end  
vendor/plugins/acts_as_solr_reloaded/lib/tasks/solr.rake
@@ -93,6 +93,12 @@ namespace :solr do @@ -93,6 +93,12 @@ namespace :solr do
93 puts "PID file not found at #{SOLR_PID_FILE}. Either Solr is not running or no PID file was written." 93 puts "PID file not found at #{SOLR_PID_FILE}. Either Solr is not running or no PID file was written."
94 end 94 end
95 end 95 end
  96 +
  97 + desc 'Restart Solr. Specify the environment by using: RAILS_ENV=your_env. Defaults to development if none.'
  98 + task :restart => :environment do
  99 + Rake::Task["solr:stop"].invoke
  100 + Rake::Task["solr:start"].invoke
  101 + end
96 102
97 desc 'Remove Solr index' 103 desc 'Remove Solr index'
98 task :destroy_index => :environment do 104 task :destroy_index => :environment do
@@ -111,39 +117,45 @@ namespace :solr do @@ -111,39 +117,45 @@ namespace :solr do
111 task :reindex => :environment do 117 task :reindex => :environment do
112 require File.expand_path("#{File.dirname(__FILE__)}/../../config/solr_environment") 118 require File.expand_path("#{File.dirname(__FILE__)}/../../config/solr_environment")
113 119
114 - optimize = env_to_bool('OPTIMIZE', true) 120 + delayed_job = env_to_bool('DELAYED_JOB', false)
  121 + optimize = env_to_bool('OPTIMIZE', !delayed_job)
115 start_server = env_to_bool('START_SERVER', false) 122 start_server = env_to_bool('START_SERVER', false)
116 offset = ENV['OFFSET'].to_i.nonzero? || 0 123 offset = ENV['OFFSET'].to_i.nonzero? || 0
117 clear_first = env_to_bool('CLEAR', offset == 0) 124 clear_first = env_to_bool('CLEAR', offset == 0)
118 batch_size = ENV['BATCH'].to_i.nonzero? || 300 125 batch_size = ENV['BATCH'].to_i.nonzero? || 300
119 debug_output = env_to_bool("DEBUG", false) 126 debug_output = env_to_bool("DEBUG", false)
  127 + models = (ENV['MODELS'] || '').split(',').map{ |m| m.constantize }
  128 + threads = (ENV['THREADS'] || '2').to_i
120 129
121 logger = ActiveRecord::Base.logger = Logger.new(STDOUT) 130 logger = ActiveRecord::Base.logger = Logger.new(STDOUT)
122 logger.level = ActiveSupport::BufferedLogger::INFO unless debug_output 131 logger.level = ActiveSupport::BufferedLogger::INFO unless debug_output
  132 + Dir["#{Rails.root}/app/models/*.rb"].each{ |file| require file }
123 133
124 if start_server 134 if start_server
125 puts "Starting Solr server..." 135 puts "Starting Solr server..."
126 Rake::Task["solr:start"].invoke 136 Rake::Task["solr:start"].invoke
127 end 137 end
128 138
129 - # Disable solr_optimize 139 + # Disable optimize and commit
130 module ActsAsSolr::CommonMethods 140 module ActsAsSolr::CommonMethods
131 def blank() end 141 def blank() end
132 alias_method :deferred_solr_optimize, :solr_optimize 142 alias_method :deferred_solr_optimize, :solr_optimize
133 alias_method :solr_optimize, :blank 143 alias_method :solr_optimize, :blank
  144 + alias_method :solr_commit, :blank
134 end 145 end
135 146
136 - $solr_indexed_models.each do |model|  
137 - 147 + models = $solr_indexed_models unless models.count > 0
  148 + models.each do |model|
138 if clear_first 149 if clear_first
139 puts "Clearing index for #{model}..." 150 puts "Clearing index for #{model}..."
140 - #ActsAsSolr::Post.execute(Solr::Request::Delete.new(:query => "#{model.solr_configuration[:type_field]}:#{model}"))  
141 - #ActsAsSolr::Post.execute(Solr::Request::Commit.new) 151 + ActsAsSolr::Post.execute(Solr::Request::Delete.new(:query => "#{model.solr_configuration[:type_field]}:#{model}"))
  152 + ActsAsSolr::Post.execute(Solr::Request::Commit.new)
142 end 153 end
143 154
144 puts "Rebuilding index for #{model}..." 155 puts "Rebuilding index for #{model}..."
145 - model.rebuild_solr_index batch_size, :offset => offset  
146 - 156 + model.rebuild_solr_index batch_size, :offset => offset, :threads => threads, :delayed_job => delayed_job
  157 + puts "Commiting changes..."
  158 + ActsAsSolr::Post.execute(Solr::Request::Commit.new)
147 end 159 end
148 160
149 if $solr_indexed_models.empty? 161 if $solr_indexed_models.empty?
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/admin-extra.html 100755 → 100644
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/elevate.xml 100755 → 100644
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/mapping-ISOLatin1Accent.txt 100755 → 100644
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/protwords.en.txt 0 → 100644
@@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
  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 +#-----------------------------------------------------------------------
  14 +# Use a protected word file to protect against the stemmer reducing two
  15 +# unrelated words to the same base word.
  16 +
  17 +# Some non-words that normally won't be encountered,
  18 +# just to test that they won't be stemmed.
  19 +
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/protwords.pt.txt 0 → 100644
@@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
  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 +#-----------------------------------------------------------------------
  14 +# Use a protected word file to protect against the stemmer reducing two
  15 +# unrelated words to the same base word.
  16 +
  17 +# Some non-words that normally won't be encountered,
  18 +# just to test that they won't be stemmed.
  19 +
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/protwords.txt
@@ -1,21 +0,0 @@ @@ -1,21 +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 -#-----------------------------------------------------------------------  
14 -# Use a protected word file to protect against the stemmer reducing two  
15 -# unrelated words to the same base word.  
16 -  
17 -# Some non-words that normally won't be encountered,  
18 -# just to test that they won't be stemmed.  
19 -dontstems  
20 -zwhacky  
21 -  
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/schema.xml 100755 → 100644
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 <fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="false"/> 41 <fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="false"/>
42 <fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="false"/> 42 <fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="false"/>
43 <fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="false"/> 43 <fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="false"/>
44 - <fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="false"/> 44 + <fieldType name="date" class="solr.TrieDateField" sortMissingLast="true" omitNorms="false"/>
45 <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100"> 45 <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
46 <analyzer> 46 <analyzer>
47 <tokenizer class="solr.WhitespaceTokenizerFactory"/> 47 <tokenizer class="solr.WhitespaceTokenizerFactory"/>
@@ -50,24 +50,48 @@ @@ -50,24 +50,48 @@
50 50
51 <fieldType name="text" class="solr.TextField" autoGeneratePhraseQueries="false"> 51 <fieldType name="text" class="solr.TextField" autoGeneratePhraseQueries="false">
52 <analyzer type="index"> 52 <analyzer type="index">
53 - <tokenizer class="solr.KeywordTokenizerFactory"/> 53 + <tokenizer class="solr.StandardTokenizerFactory"/>
54 <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> 54 <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  55 +
  56 + <filter class="solr.ASCIIFoldingFilterFactory"/>
55 <filter class="solr.LowerCaseFilterFactory"/> 57 <filter class="solr.LowerCaseFilterFactory"/>
56 - <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0"/> 58 +
  59 + <filter class="solr.StopFilterFactory" words="stopwords.pt.txt" />
  60 +
  61 + <!-- stemming
  62 + -->
  63 + <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.pt.txt" />
  64 + <filter class="solr.PortugueseStemFilterFactory" />
  65 + <!-- too slow
57 <filter class="solr.HunspellStemFilterFactory" dictionary="en_US.dic" affix="en_US.aff" ignoreCase="true" /> 66 <filter class="solr.HunspellStemFilterFactory" dictionary="en_US.dic" affix="en_US.aff" ignoreCase="true" />
58 <filter class="solr.HunspellStemFilterFactory" dictionary="pt_PT.dic" affix="pt_PT.aff" ignoreCase="true" /> 67 <filter class="solr.HunspellStemFilterFactory" dictionary="pt_PT.dic" affix="pt_PT.aff" ignoreCase="true" />
59 - <filter class="solr.ASCIIFoldingFilterFactory"/> 68 + -->
  69 +
  70 + <!-- improvised stemming
60 <filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="20" side="front"/> 71 <filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="20" side="front"/>
  72 + -->
61 </analyzer> 73 </analyzer>
62 <analyzer type="query"> 74 <analyzer type="query">
63 - <tokenizer class="solr.WhitespaceTokenizerFactory"/> 75 + <tokenizer class="solr.StandardTokenizerFactory"/>
64 <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> 76 <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  77 +
  78 + <filter class="solr.ASCIIFoldingFilterFactory"/>
65 <filter class="solr.LowerCaseFilterFactory"/> 79 <filter class="solr.LowerCaseFilterFactory"/>
66 - <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0"/> 80 +
  81 + <filter class="solr.StopFilterFactory" words="stopwords.pt.txt" />
  82 +
  83 + <!-- stemming
  84 + -->
  85 + <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.pt.txt" />
  86 + <filter class="solr.PortugueseStemFilterFactory" />
  87 + <!-- too slow
67 <filter class="solr.HunspellStemFilterFactory" dictionary="en_US.dic" affix="en_US.aff" ignoreCase="true" /> 88 <filter class="solr.HunspellStemFilterFactory" dictionary="en_US.dic" affix="en_US.aff" ignoreCase="true" />
68 <filter class="solr.HunspellStemFilterFactory" dictionary="pt_PT.dic" affix="pt_PT.aff" ignoreCase="true" /> 89 <filter class="solr.HunspellStemFilterFactory" dictionary="pt_PT.dic" affix="pt_PT.aff" ignoreCase="true" />
69 - <filter class="solr.ASCIIFoldingFilterFactory"/> 90 + -->
  91 +
  92 + <!-- improvised stemming
70 <filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="20" side="front"/> 93 <filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="20" side="front"/>
  94 + -->
71 </analyzer> 95 </analyzer>
72 </fieldType> 96 </fieldType>
73 97
@@ -93,11 +117,18 @@ @@ -93,11 +117,18 @@
93 </analyzer> 117 </analyzer>
94 </fieldType> 118 </fieldType>
95 119
  120 + <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
  121 +
96 </types> 122 </types>
97 123
98 124
99 <fields> 125 <fields>
  126 + <field name="latlng" type="location" indexed="true" stored="true" />
  127 + <field name="latlng_0_coordinate" type="sdouble" indexed="true" stored="true" multiValued="false"/>
  128 + <field name="latlng_1_coordinate" type="sdouble" indexed="true" stored="true" multiValued="false"/>
  129 +
100 <field name="id" type="string" indexed="true" stored="true" required="true" /> 130 <field name="id" type="string" indexed="true" stored="true" required="true" />
  131 + <field name="type_s" type="string" indexed="true" stored="false" />
101 <field name="pk_i" type="integer" indexed="true" stored="true"/> 132 <field name="pk_i" type="integer" indexed="true" stored="true"/>
102 <field name="pk_s" type="string" indexed="true" stored="true"/> 133 <field name="pk_s" type="string" indexed="true" stored="true"/>
103 <field name="text" type="text" indexed="true" stored="false" multiValued="true"/> 134 <field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
@@ -106,9 +137,10 @@ @@ -106,9 +137,10 @@
106 <dynamicField name="*_i" type="integer" indexed="true" stored="false"/> 137 <dynamicField name="*_i" type="integer" indexed="true" stored="false"/>
107 <dynamicField name="*_t" type="text" indexed="true" stored="true"/> 138 <dynamicField name="*_t" type="text" indexed="true" stored="true"/>
108 <dynamicField name="*_f" type="float" indexed="true" stored="false" multiValued="false"/> 139 <dynamicField name="*_f" type="float" indexed="true" stored="false" multiValued="false"/>
  140 + <dynamicField name="*_do" type="double" indexed="true" stored="false" multiValued="false"/>
109 <dynamicField name="*_b" type="boolean" indexed="true" stored="false"/> 141 <dynamicField name="*_b" type="boolean" indexed="true" stored="false"/>
110 <dynamicField name="*_d" type="date" indexed="true" stored="false" multiValued="false"/> 142 <dynamicField name="*_d" type="date" indexed="true" stored="false" multiValued="false"/>
111 - <dynamicField name="*_s" type="string" indexed="true" stored="false" multiValued="false"/> 143 + <dynamicField name="*_s" type="string" indexed="true" stored="true" multiValued="false"/>
112 <dynamicField name="*_ri" type="sint" indexed="true" stored="false"/> 144 <dynamicField name="*_ri" type="sint" indexed="true" stored="false"/>
113 <dynamicField name="*_rf" type="sfloat" indexed="true" stored="false"/> 145 <dynamicField name="*_rf" type="sfloat" indexed="true" stored="false"/>
114 <dynamicField name="*_facet" type="string" indexed="true" stored="false"/> 146 <dynamicField name="*_facet" type="string" indexed="true" stored="false"/>
@@ -125,6 +157,9 @@ @@ -125,6 +157,9 @@
125 <uniqueKey>id</uniqueKey> 157 <uniqueKey>id</uniqueKey>
126 <defaultSearchField>text</defaultSearchField> 158 <defaultSearchField>text</defaultSearchField>
127 159
  160 + <copyField source="lat_f" dest="latlng_0_coordinate"/>
  161 + <copyField source="lng_f" dest="latlng_1_coordinate"/>
  162 +
128 <copyField source="*_s" dest="text"/> 163 <copyField source="*_s" dest="text"/>
129 <copyField source="*_s" dest="spell"/> 164 <copyField source="*_s" dest="spell"/>
130 <copyField source="*_t" dest="text"/> 165 <copyField source="*_t" dest="text"/>
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/scripts.conf 100755 → 100644
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/solrconfig.xml 100755 → 100644
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 - <useCompoundFile>false</useCompoundFile>  
38 -  
39 - <mergeFactor>10</mergeFactor>  
40 - <!--  
41 - If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first.  
42 -  
43 - -->  
44 - <!--<maxBufferedDocs>1000</maxBufferedDocs>-->  
45 - <!-- Tell Lucene when to flush documents to disk.  
46 - Giving Lucene more memory for indexing means faster indexing at the cost of more RAM  
47 -  
48 - If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first.  
49 -  
50 - -->  
51 - <ramBufferSizeMB>32</ramBufferSizeMB>  
52 - <maxMergeDocs>2147483647</maxMergeDocs>  
53 - <maxFieldLength>10000</maxFieldLength>  
54 - <writeLockTimeout>1000</writeLockTimeout>  
55 - <commitLockTimeout>10000</commitLockTimeout>  
56 -  
57 - <!--  
58 - Expert: Turn on Lucene's auto commit capability.  
59 - This causes intermediate segment flushes to write a new lucene  
60 - index descriptor, enabling it to be opened by an external  
61 - IndexReader.  
62 - NOTE: Despite the name, this value does not have any relation to Solr's autoCommit functionality  
63 - -->  
64 - <!--<luceneAutoCommit>false</luceneAutoCommit>-->  
65 - <!--  
66 - Expert:  
67 - The Merge Policy in Lucene controls how merging is handled by Lucene. The default in 2.3 is the LogByteSizeMergePolicy, previous  
68 - versions used LogDocMergePolicy.  
69 -  
70 - LogByteSizeMergePolicy chooses segments to merge based on their size. The Lucene 2.2 default, LogDocMergePolicy chose when  
71 - to merge based on number of documents  
72 -  
73 - Other implementations of MergePolicy must have a no-argument constructor  
74 - -->  
75 - <!--<mergePolicy>org.apache.lucene.index.LogByteSizeMergePolicy</mergePolicy>-->  
76 -  
77 - <!--  
78 - Expert:  
79 - The Merge Scheduler in Lucene controls how merges are performed. The ConcurrentMergeScheduler (Lucene 2.3 default)  
80 - can perform merges in the background using separate threads. The SerialMergeScheduler (Lucene 2.2 default) does not.  
81 - -->  
82 - <!--<mergeScheduler>org.apache.lucene.index.ConcurrentMergeScheduler</mergeScheduler>-->  
83 -  
84 - <!--  
85 - This option specifies which Lucene LockFactory implementation to use.  
86 -  
87 - single = SingleInstanceLockFactory - suggested for a read-only index  
88 - or when there is no possibility of another process trying  
89 - to modify the index.  
90 - native = NativeFSLockFactory  
91 - simple = SimpleFSLockFactory  
92 -  
93 - (For backwards compatibility with Solr 1.2, 'simple' is the default  
94 - if not specified.)  
95 - -->  
96 - <lockType>single</lockType>  
97 - </indexDefaults>  
98 -  
99 - <mainIndex>  
100 - <!-- options specific to the main on-disk lucene index -->  
101 - <useCompoundFile>false</useCompoundFile>  
102 - <ramBufferSizeMB>32</ramBufferSizeMB>  
103 - <mergeFactor>10</mergeFactor>  
104 - <!-- Deprecated -->  
105 - <!--<maxBufferedDocs>1000</maxBufferedDocs>-->  
106 - <maxMergeDocs>2147483647</maxMergeDocs>  
107 - <maxFieldLength>10000</maxFieldLength>  
108 -  
109 - <!-- If true, unlock any held write or commit locks on startup.  
110 - This defeats the locking mechanism that allows multiple  
111 - processes to safely access a lucene index, and should be  
112 - used with care.  
113 - This is not needed if lock type is 'none' or 'single'  
114 - -->  
115 - <unlockOnStartup>false</unlockOnStartup>  
116 -  
117 - <!-- If true, IndexReaders will be reopened (often more efficient) instead  
118 - of closed and then opened.  
119 - -->  
120 - <reopenReaders>true</reopenReaders>  
121 -  
122 - <!--  
123 - Custom deletion policies can specified here. The class must  
124 - implement org.apache.lucene.index.IndexDeletionPolicy.  
125 -  
126 - http://lucene.apache.org/java/2_3_2/api/org/apache/lucene/index/IndexDeletionPolicy.html  
127 -  
128 - The standard Solr IndexDeletionPolicy implementation supports deleting  
129 - index commit points on number of commits, age of commit point and  
130 - optimized status.  
131 -  
132 - The latest commit point should always be preserved regardless  
133 - of the criteria.  
134 - -->  
135 - <deletionPolicy class="solr.SolrDeletionPolicy">  
136 - <!-- Keep only optimized commit points -->  
137 - <str name="keepOptimizedOnly">false</str>  
138 - <!-- The maximum number of commit points to be kept -->  
139 - <str name="maxCommitsToKeep">1</str>  
140 - <!--  
141 - Delete all commit points once they have reached the given age.  
142 - Supports DateMathParser syntax e.g.  
143 -  
144 - <str name="maxCommitAge">30MINUTES</str>  
145 - <str name="maxCommitAge">1DAY</str>  
146 - -->  
147 - </deletionPolicy>  
148 -  
149 - </mainIndex>  
150 -  
151 - <!-- Enables JMX if and only if an existing MBeanServer is found, use  
152 - this if you want to configure JMX through JVM parameters. Remove  
153 - this to disable exposing Solr configuration and statistics to JMX.  
154 -  
155 - If you want to connect to a particular server, specify the agentId  
156 - e.g. <jmx agentId="myAgent" />  
157 -  
158 - If you want to start a new MBeanServer, specify the serviceUrl  
159 - e.g <jmx serviceUrl="service:jmx:rmi:///jndi/rmi://localhost:9999/solr" />  
160 -  
161 - For more details see http://wiki.apache.org/solr/SolrJmx  
162 - -->  
163 - <jmx />  
164 -  
165 - <!-- the default high-performance update handler -->  
166 - <updateHandler class="solr.DirectUpdateHandler2">  
167 -  
168 - <!-- A prefix of "solr." for class names is an alias that  
169 - causes solr to search appropriate packages, including  
170 - org.apache.solr.(search|update|request|core|analysis)  
171 - -->  
172 -  
173 - <!-- Perform a <commit/> automatically under certain conditions:  
174 - maxDocs - number of updates since last commit is greater than this  
175 - maxTime - oldest uncommited update (in ms) is this long ago  
176 - <autoCommit>  
177 - <maxDocs>10000</maxDocs>  
178 - <maxTime>1000</maxTime>  
179 - </autoCommit>  
180 - -->  
181 -  
182 - <!-- The RunExecutableListener executes an external command.  
183 - exe - the name of the executable to run  
184 - dir - dir to use as the current working directory. default="."  
185 - wait - the calling thread waits until the executable returns. default="true"  
186 - args - the arguments to pass to the program. default=nothing  
187 - env - environment variables to set. default=nothing  
188 - -->  
189 - <!-- A postCommit event is fired after every commit or optimize command  
190 - <listener event="postCommit" class="solr.RunExecutableListener">  
191 - <str name="exe">solr/bin/snapshooter</str>  
192 - <str name="dir">.</str>  
193 - <bool name="wait">true</bool>  
194 - <arr name="args"> <str>arg1</str> <str>arg2</str> </arr>  
195 - <arr name="env"> <str>MYVAR=val1</str> </arr>  
196 - </listener>  
197 - -->  
198 - <!-- A postOptimize event is fired only after every optimize command, useful  
199 - in conjunction with index distribution to only distribute optimized indicies  
200 - <listener event="postOptimize" class="solr.RunExecutableListener">  
201 - <str name="exe">snapshooter</str>  
202 - <str name="dir">solr/bin</str>  
203 - <bool name="wait">true</bool>  
204 - </listener>  
205 - -->  
206 -  
207 - </updateHandler>  
208 -  
209 - <!-- Use the following format to specify a custom IndexReaderFactory - allows for alternate  
210 - IndexReader implementations.  
211 - <indexReaderFactory name="IndexReaderFactory" class="package.class">  
212 - Parameters as required by the implementation  
213 - </indexReaderFactory >  
214 - -->  
215 -  
216 - <updateRequestProcessorChain>  
217 - <processor class="solr.RunUpdateProcessorFactory" />  
218 - <processor class="solr.LogUpdateProcessorFactory" />  
219 - </updateRequestProcessorChain>  
220 -  
221 -  
222 -  
223 - <query>  
224 - <!-- Maximum number of clauses in a boolean query... can affect  
225 - range or prefix queries that expand to big boolean  
226 - queries. An exception is thrown if exceeded. -->  
227 - <maxBooleanClauses>1024</maxBooleanClauses>  
228 -  
229 -  
230 - <!-- There are two implementations of cache available for Solr,  
231 - LRUCache, based on a synchronized LinkedHashMap, and  
232 - FastLRUCache, based on a ConcurrentHashMap. FastLRUCache has faster gets  
233 - and slower puts in single threaded operation and thus is generally faster  
234 - than LRUCache when the hit ratio of the cache is high (> 75%), and may be  
235 - faster under other scenarios on multi-cpu systems. -->  
236 - <!-- Cache used by SolrIndexSearcher for filters (DocSets),  
237 - unordered sets of *all* documents that match a query.  
238 - When a new searcher is opened, its caches may be prepopulated  
239 - or "autowarmed" using data from caches in the old searcher.  
240 - autowarmCount is the number of items to prepopulate. For LRUCache,  
241 - the autowarmed items will be the most recently accessed items.  
242 - Parameters:  
243 - class - the SolrCache implementation LRUCache or FastLRUCache  
244 - size - the maximum number of entries in the cache  
245 - initialSize - the initial capacity (number of entries) of  
246 - the cache. (seel java.util.HashMap)  
247 - autowarmCount - the number of entries to prepopulate from  
248 - and old cache.  
249 - -->  
250 - <filterCache  
251 - class="solr.FastLRUCache"  
252 - size="512"  
253 - initialSize="512"  
254 - autowarmCount="128"/>  
255 -  
256 - <!-- Cache used to hold field values that are quickly accessible  
257 - by document id. The fieldValueCache is created by default  
258 - even if not configured here.  
259 - <fieldValueCache  
260 - class="solr.FastLRUCache"  
261 - size="512"  
262 - autowarmCount="128"  
263 - showItems="32"  
264 - />  
265 - -->  
266 -  
267 - <!-- queryResultCache caches results of searches - ordered lists of  
268 - document ids (DocList) based on a query, a sort, and the range  
269 - of documents requested. -->  
270 - <queryResultCache  
271 - class="solr.LRUCache"  
272 - size="512"  
273 - initialSize="512"  
274 - autowarmCount="32"/>  
275 -  
276 - <!-- documentCache caches Lucene Document objects (the stored fields for each document).  
277 - Since Lucene internal document ids are transient, this cache will not be autowarmed. -->  
278 - <documentCache  
279 - class="solr.LRUCache"  
280 - size="512"  
281 - initialSize="512"  
282 - autowarmCount="0"/>  
283 -  
284 - <!-- If true, stored fields that are not requested will be loaded lazily.  
285 -  
286 - This can result in a significant speed improvement if the usual case is to  
287 - not load all stored fields, especially if the skipped fields are large compressed  
288 - text fields.  
289 - -->  
290 - <enableLazyFieldLoading>true</enableLazyFieldLoading>  
291 -  
292 - <!-- Example of a generic cache. These caches may be accessed by name  
293 - through SolrIndexSearcher.getCache(),cacheLookup(), and cacheInsert().  
294 - The purpose is to enable easy caching of user/application level data.  
295 - The regenerator argument should be specified as an implementation  
296 - of solr.search.CacheRegenerator if autowarming is desired. -->  
297 - <!--  
298 - <cache name="myUserCache"  
299 - class="solr.LRUCache"  
300 - size="4096"  
301 - initialSize="1024"  
302 - autowarmCount="1024"  
303 - regenerator="org.mycompany.mypackage.MyRegenerator"  
304 - />  
305 - -->  
306 -  
307 - <!-- An optimization that attempts to use a filter to satisfy a search.  
308 - If the requested sort does not include score, then the filterCache  
309 - will be checked for a filter matching the query. If found, the filter  
310 - will be used as the source of document ids, and then the sort will be  
311 - applied to that.  
312 - <useFilterForSortedQuery>true</useFilterForSortedQuery>  
313 - -->  
314 -  
315 - <!-- An optimization for use with the queryResultCache. When a search  
316 - is requested, a superset of the requested number of document ids  
317 - are collected. For example, if a search for a particular query  
318 - requests matching documents 10 through 19, and queryWindowSize is 50,  
319 - then documents 0 through 49 will be collected and cached. Any further  
320 - requests in that range can be satisfied via the cache. -->  
321 - <queryResultWindowSize>50</queryResultWindowSize>  
322 -  
323 - <!-- Maximum number of documents to cache for any entry in the  
324 - queryResultCache. -->  
325 - <queryResultMaxDocsCached>200</queryResultMaxDocsCached>  
326 -  
327 - <!-- a newSearcher event is fired whenever a new searcher is being prepared  
328 - and there is a current searcher handling requests (aka registered). -->  
329 - <!-- QuerySenderListener takes an array of NamedList and executes a  
330 - local query request for each NamedList in sequence. -->  
331 - <listener event="newSearcher" class="solr.QuerySenderListener">  
332 - <arr name="queries">  
333 - <lst> <str name="q">solr</str> <str name="start">0</str> <str name="rows">10</str> </lst>  
334 - <lst> <str name="q">rocks</str> <str name="start">0</str> <str name="rows">10</str> </lst>  
335 - <lst><str name="q">static newSearcher warming query from solrconfig.xml</str></lst>  
336 - </arr>  
337 - </listener>  
338 -  
339 - <!-- a firstSearcher event is fired whenever a new searcher is being  
340 - prepared but there is no current registered searcher to handle  
341 - requests or to gain autowarming data from. -->  
342 - <listener event="firstSearcher" class="solr.QuerySenderListener">  
343 - <arr name="queries">  
344 - <lst> <str name="q">fast_warm</str> <str name="start">0</str> <str name="rows">10</str> </lst>  
345 - <lst><str name="q">static firstSearcher warming query from solrconfig.xml</str></lst>  
346 - </arr>  
347 - </listener>  
348 -  
349 - <!-- If a search request comes in and there is no current registered searcher,  
350 - then immediately register the still warming searcher and use it. If  
351 - "false" then all requests will block until the first searcher is done  
352 - warming. -->  
353 - <useColdSearcher>false</useColdSearcher>  
354 -  
355 - <!-- Maximum number of searchers that may be warming in the background  
356 - concurrently. An error is returned if this limit is exceeded. Recommend  
357 - 1-2 for read-only slaves, higher for masters w/o cache warming. -->  
358 - <maxWarmingSearchers>2</maxWarmingSearchers>  
359 -  
360 - </query>  
361 -  
362 - <!--  
363 - Let the dispatch filter handler /select?qt=XXX  
364 - handleSelect=true will use consistent error handling for /select and /update  
365 - handleSelect=false will use solr1.1 style error formatting  
366 - -->  
367 - <requestDispatcher handleSelect="true" >  
368 - <!--Make sure your system has some authentication before enabling remote streaming! -->  
369 - <requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048000" />  
370 -  
371 - <!-- Set HTTP caching related parameters (for proxy caches and clients).  
372 -  
373 - To get the behaviour of Solr 1.2 (ie: no caching related headers)  
374 - use the never304="true" option and do not specify a value for  
375 - <cacheControl>  
376 - -->  
377 - <!-- <httpCaching never304="true"> -->  
378 - <httpCaching lastModifiedFrom="openTime"  
379 - etagSeed="Solr">  
380 - <!-- lastModFrom="openTime" is the default, the Last-Modified value  
381 - (and validation against If-Modified-Since requests) will all be  
382 - relative to when the current Searcher was opened.  
383 - You can change it to lastModFrom="dirLastMod" if you want the  
384 - value to exactly corrispond to when the physical index was last  
385 - modified.  
386 -  
387 - etagSeed="..." is an option you can change to force the ETag  
388 - header (and validation against If-None-Match requests) to be  
389 - differnet even if the index has not changed (ie: when making  
390 - significant changes to your config file)  
391 -  
392 - lastModifiedFrom and etagSeed are both ignored if you use the  
393 - never304="true" option.  
394 - -->  
395 - <!-- If you include a <cacheControl> directive, it will be used to  
396 - generate a Cache-Control header, as well as an Expires header  
397 - if the value contains "max-age="  
398 -  
399 - By default, no Cache-Control header is generated.  
400 -  
401 - You can use the <cacheControl> option even if you have set  
402 - never304="true"  
403 - -->  
404 - <!-- <cacheControl>max-age=30, public</cacheControl> -->  
405 - </httpCaching>  
406 - </requestDispatcher>  
407 -  
408 -  
409 - <!-- requestHandler plugins... incoming queries will be dispatched to the  
410 - correct handler based on the path or the qt (query type) param.  
411 - Names starting with a '/' are accessed with the a path equal to the  
412 - registered name. Names without a leading '/' are accessed with:  
413 - http://host/app/select?qt=name  
414 - If no qt is defined, the requestHandler that declares default="true"  
415 - will be used.  
416 - -->  
417 - <requestHandler name="standard" class="solr.SearchHandler" default="true">  
418 - <!-- default values for query parameters -->  
419 - <lst name="defaults">  
420 - <str name="echoParams">explicit</str>  
421 - <str name="json.nl">map</str>  
422 - <!--  
423 - <int name="rows">10</int>  
424 - <str name="fl">*</str>  
425 - <str name="version">2.1</str>  
426 - -->  
427 - </lst>  
428 -  
429 - <arr name="last-components">  
430 - <str>spellcheck</str>  
431 - </arr>  
432 - </requestHandler>  
433 -  
434 -<!-- Please refer to http://wiki.apache.org/solr/SolrReplication for details on configuring replication -->  
435 -<!--Master config-->  
436 -<!--  
437 -<requestHandler name="/replication" class="solr.ReplicationHandler" >  
438 - <lst name="master">  
439 - <str name="replicateAfter">commit</str>  
440 - <str name="confFiles">schema.xml,stopwords.txt</str>  
441 - </lst>  
442 -</requestHandler>  
443 --->  
444 -<!-- Slave config-->  
445 -<!--  
446 -<requestHandler name="/replication" class="solr.ReplicationHandler">  
447 - <lst name="slave">  
448 - <str name="masterUrl">http://localhost:8983/solr/replication</str>  
449 - <str name="pollInterval">00:00:60</str>  
450 - </lst>  
451 -</requestHandler>  
452 --->  
453 -  
454 - <!-- DisMaxRequestHandler allows easy searching across multiple fields  
455 - for simple user-entered phrases. It's implementation is now  
456 - just the standard SearchHandler with a default query type  
457 - of "dismax".  
458 - see http://wiki.apache.org/solr/DisMaxRequestHandler  
459 - -->  
460 - <requestHandler name="dismax" class="solr.SearchHandler" >  
461 - <lst name="defaults">  
462 - <str name="defType">dismax</str>  
463 - <str name="echoParams">explicit</str>  
464 - <float name="tie">0.01</float>  
465 - <str name="qf">  
466 - text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4  
467 - </str>  
468 - <str name="pf">  
469 - text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9  
470 - </str>  
471 - <str name="bf">  
472 - ord(popularity)^0.5 recip(rord(price),1,1000,1000)^0.3  
473 - </str>  
474 - <str name="fl">  
475 - id,name,price,score  
476 - </str>  
477 - <str name="mm">  
478 - 2&lt;-1 5&lt;-2 6&lt;90%  
479 - </str>  
480 - <int name="ps">100</int>  
481 - <str name="q.alt">*:*</str>  
482 - <!-- example highlighter config, enable per-query with hl=true -->  
483 - <str name="hl.fl">text features name</str>  
484 - <!-- for this field, we want no fragmenting, just highlighting -->  
485 - <str name="f.name.hl.fragsize">0</str>  
486 - <!-- instructs Solr to return the field itself if no query terms are  
487 - found -->  
488 - <str name="f.name.hl.alternateField">name</str>  
489 - <str name="f.text.hl.fragmenter">regex</str> <!-- defined below -->  
490 - </lst>  
491 - </requestHandler>  
492 -  
493 - <!-- Note how you can register the same handler multiple times with  
494 - different names (and different init parameters)  
495 - -->  
496 - <requestHandler name="partitioned" class="solr.SearchHandler" >  
497 - <lst name="defaults">  
498 - <str name="defType">dismax</str>  
499 - <str name="echoParams">explicit</str>  
500 - <str name="qf">text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0</str>  
501 - <str name="mm">2&lt;-1 5&lt;-2 6&lt;90%</str>  
502 - <!-- This is an example of using Date Math to specify a constantly  
503 - moving date range in a config...  
504 - -->  
505 - <str name="bq">incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2</str>  
506 - </lst>  
507 - <!-- In addition to defaults, "appends" params can be specified  
508 - to identify values which should be appended to the list of  
509 - multi-val params from the query (or the existing "defaults").  
510 -  
511 - In this example, the param "fq=instock:true" will be appended to  
512 - any query time fq params the user may specify, as a mechanism for  
513 - partitioning the index, independent of any user selected filtering  
514 - that may also be desired (perhaps as a result of faceted searching).  
515 -  
516 - NOTE: there is *absolutely* nothing a client can do to prevent these  
517 - "appends" values from being used, so don't use this mechanism  
518 - unless you are sure you always want it.  
519 - -->  
520 - <lst name="appends">  
521 - <str name="fq">inStock:true</str>  
522 - </lst>  
523 - <!-- "invariants" are a way of letting the Solr maintainer lock down  
524 - the options available to Solr clients. Any params values  
525 - specified here are used regardless of what values may be specified  
526 - in either the query, the "defaults", or the "appends" params.  
527 -  
528 - In this example, the facet.field and facet.query params are fixed,  
529 - limiting the facets clients can use. Faceting is not turned on by  
530 - default - but if the client does specify facet=true in the request,  
531 - these are the only facets they will be able to see counts for;  
532 - regardless of what other facet.field or facet.query params they  
533 - may specify.  
534 -  
535 - NOTE: there is *absolutely* nothing a client can do to prevent these  
536 - "invariants" values from being used, so don't use this mechanism  
537 - unless you are sure you always want it.  
538 - -->  
539 - <lst name="invariants">  
540 - <str name="facet.field">cat</str>  
541 - <str name="facet.field">manu_exact</str>  
542 - <str name="facet.query">price:[* TO 500]</str>  
543 - <str name="facet.query">price:[500 TO *]</str>  
544 - </lst>  
545 - </requestHandler>  
546 -  
547 -  
548 - <!--  
549 - Search components are registered to SolrCore and used by Search Handlers  
550 -  
551 - By default, the following components are avaliable:  
552 -  
553 - <searchComponent name="query" class="org.apache.solr.handler.component.QueryComponent" />  
554 - <searchComponent name="facet" class="org.apache.solr.handler.component.FacetComponent" />  
555 - <searchComponent name="mlt" class="org.apache.solr.handler.component.MoreLikeThisComponent" />  
556 - <searchComponent name="highlight" class="org.apache.solr.handler.component.HighlightComponent" />  
557 - <searchComponent name="stats" class="org.apache.solr.handler.component.StatsComponent" />  
558 - <searchComponent name="debug" class="org.apache.solr.handler.component.DebugComponent" />  
559 -  
560 - Default configuration in a requestHandler would look like:  
561 - <arr name="components">  
562 - <str>query</str>  
563 - <str>facet</str>  
564 - <str>mlt</str>  
565 - <str>highlight</str>  
566 - <str>stats</str>  
567 - <str>debug</str>  
568 - </arr>  
569 -  
570 - If you register a searchComponent to one of the standard names, that will be used instead.  
571 - To insert components before or after the 'standard' components, use:  
572 -  
573 - <arr name="first-components">  
574 - <str>myFirstComponentName</str>  
575 - </arr>  
576 -  
577 - <arr name="last-components">  
578 - <str>myLastComponentName</str>  
579 - </arr>  
580 - -->  
581 -  
582 - <!-- The spell check component can return a list of alternative spelling  
583 - suggestions. -->  
584 - <searchComponent name="spellcheck" class="solr.SpellCheckComponent">  
585 -  
586 - <str name="queryAnalyzerFieldType">textSpell</str>  
587 -  
588 - <lst name="spellchecker">  
589 - <str name="name">default</str>  
590 - <str name="field">spell</str>  
591 - <str name="spellcheckIndexDir">./spellchecker1</str>  
592 - <str name="buildOnCommit">true</str>  
593 - <str name="buildOnOptimize">true</str>  
594 - </lst>  
595 -  
596 - <lst name="spellchecker">  
597 - <str name="name">jarowinkler</str>  
598 - <str name="field">spell</str>  
599 - <str name="distanceMeasure">org.apache.lucene.search.spell.JaroWinklerDistance</str>  
600 - <str name="spellcheckIndexDir">./spellchecker2</str>  
601 - </lst>  
602 -  
603 - <lst name="spellchecker">  
604 - <str name="classname">solr.FileBasedSpellChecker</str>  
605 - <str name="name">file</str>  
606 - <str name="sourceLocation">spellings.txt</str>  
607 - <str name="characterEncoding">UTF-8</str>  
608 - <str name="spellcheckIndexDir">./spellcheckerFile</str>  
609 - </lst>  
610 - </searchComponent>  
611 -  
612 - <!-- A request handler utilizing the spellcheck component.  
613 - ################################################################################################  
614 - NOTE: This is purely as an example. The whole purpose of the SpellCheckComponent is to hook it into  
615 - the request handler that handles (i.e. the standard or dismax SearchHandler)  
616 - queries such that a separate request is not needed to get suggestions.  
617 -  
618 - IN OTHER WORDS, THERE IS REALLY GOOD CHANCE THE SETUP BELOW IS NOT WHAT YOU WANT FOR YOUR PRODUCTION SYSTEM!  
619 - ################################################################################################  
620 - -->  
621 - <requestHandler name="/spellCheckCompRH" class="solr.SearchHandler">  
622 - <lst name="defaults">  
623 - <!-- omp = Only More Popular -->  
624 - <str name="spellcheck.onlyMorePopular">false</str>  
625 - <!-- exr = Extended Results -->  
626 - <str name="spellcheck.extendedResults">false</str>  
627 - <!-- The number of suggestions to return -->  
628 - <str name="spellcheck.count">1</str>  
629 - </lst>  
630 - <arr name="last-components">  
631 - <str>spellcheck</str>  
632 - </arr>  
633 - </requestHandler>  
634 -  
635 - <searchComponent name="tvComponent" class="org.apache.solr.handler.component.TermVectorComponent"/>  
636 - <!-- A Req Handler for working with the tvComponent. This is purely as an example.  
637 - You will likely want to add the component to your already specified request handlers. -->  
638 - <requestHandler name="tvrh" class="org.apache.solr.handler.component.SearchHandler">  
639 - <lst name="defaults">  
640 - <bool name="tv">true</bool>  
641 - </lst>  
642 - <arr name="last-components">  
643 - <str>tvComponent</str>  
644 - </arr>  
645 - </requestHandler>  
646 -  
647 -<!--  
648 - <requestHandler name="/update/extract" class="org.apache.solr.handler.extraction.ExtractingRequestHandler">  
649 - <lst name="defaults">  
650 - <str name="ext.map.Last-Modified">last_modified</str>  
651 - <bool name="ext.ignore.und.fl">true</bool>  
652 - </lst>  
653 - </requestHandler>  
654 --->  
655 -  
656 -  
657 - <!-- A component to return terms and document frequency of those terms.  
658 - This component does not yet support distributed search. -->  
659 - <searchComponent name="termsComponent" class="org.apache.solr.handler.component.TermsComponent"/>  
660 -  
661 - <requestHandler name="/terms" class="org.apache.solr.handler.component.SearchHandler">  
662 - <lst name="defaults">  
663 - <bool name="terms">true</bool>  
664 - </lst>  
665 - <arr name="components">  
666 - <str>termsComponent</str>  
667 - </arr>  
668 - </requestHandler>  
669 -  
670 -  
671 - <!-- a search component that enables you to configure the top results for  
672 - a given query regardless of the normal lucene scoring.-->  
673 - <searchComponent name="elevator" class="solr.QueryElevationComponent" >  
674 - <!-- pick a fieldType to analyze queries -->  
675 - <str name="queryFieldType">string</str>  
676 - <str name="config-file">elevate.xml</str>  
677 - </searchComponent>  
678 -  
679 - <!-- a request handler utilizing the elevator component -->  
680 - <requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">  
681 - <lst name="defaults">  
682 - <str name="echoParams">explicit</str>  
683 - </lst>  
684 - <arr name="last-components">  
685 - <str>elevator</str>  
686 - </arr>  
687 - </requestHandler>  
688 -  
689 -  
690 - <!-- Update request handler.  
691 -  
692 - Note: Since solr1.1 requestHandlers requires a valid content type header if posted in  
693 - the body. For example, curl now requires: -H 'Content-type:text/xml; charset=utf-8'  
694 - The response format differs from solr1.1 formatting and returns a standard error code.  
695 -  
696 - To enable solr1.1 behavior, remove the /update handler or change its path  
697 - -->  
698 - <requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />  
699 -  
700 -  
701 - <requestHandler name="/update/javabin" class="solr.BinaryUpdateRequestHandler" />  
702 -  
703 - <!--  
704 - Analysis request handler. Since Solr 1.3. Use to return how a document is analyzed. Useful  
705 - for debugging and as a token server for other types of applications.  
706 -  
707 - This is deprecated in favor of the improved DocumentAnalysisRequestHandler and FieldAnalysisRequestHandler  
708 -  
709 - <requestHandler name="/analysis" class="solr.AnalysisRequestHandler" />  
710 - -->  
711 -  
712 - <!--  
713 - An analysis handler that provides a breakdown of the analysis process of provided docuemnts. This handler expects a  
714 - (single) content stream with the following format:  
715 -  
716 - <docs>  
717 - <doc>  
718 - <field name="id">1</field>  
719 - <field name="name">The Name</field>  
720 - <field name="text">The Text Value</field>  
721 - <doc>  
722 - <doc>...</doc>  
723 - <doc>...</doc>  
724 - ...  
725 - </docs>  
726 -  
727 - Note: Each document must contain a field which serves as the unique key. This key is used in the returned  
728 - response to assoicate an analysis breakdown to the analyzed document.  
729 -  
730 - Like the FieldAnalysisRequestHandler, this handler also supports query analysis by  
731 - sending either an "analysis.query" or "q" request paraemter that holds the query text to be analyized. It also  
732 - supports the "analysis.showmatch" parameter which when set to true, all field tokens that match the query  
733 - tokens will be marked as a "match".  
734 - -->  
735 - <requestHandler name="/analysis/document" class="solr.DocumentAnalysisRequestHandler" />  
736 -  
737 - <!--  
738 - RequestHandler that provides much the same functionality as analysis.jsp. Provides the ability  
739 - to specify multiple field types and field names in the same request and outputs index-time and  
740 - query-time analysis for each of them.  
741 -  
742 - Request parameters are:  
743 - analysis.fieldname - The field name whose analyzers are to be used  
744 - analysis.fieldtype - The field type whose analyzers are to be used  
745 - analysis.fieldvalue - The text for index-time analysis  
746 - q (or analysis.q) - The text for query time analysis  
747 - analysis.showmatch (true|false) - When set to true and when query analysis is performed, the produced  
748 - tokens of the field value analysis will be marked as "matched" for every  
749 - token that is produces by the query analysis  
750 - -->  
751 - <requestHandler name="/analysis/field" class="solr.FieldAnalysisRequestHandler" />  
752 -  
753 -  
754 - <!-- CSV update handler, loaded on demand -->  
755 - <requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy" />  
756 -  
757 -  
758 - <!--  
759 - Admin Handlers - This will register all the standard admin RequestHandlers. Adding  
760 - this single handler is equivalent to registering:  
761 -  
762 - <requestHandler name="/admin/luke" class="org.apache.solr.handler.admin.LukeRequestHandler" />  
763 - <requestHandler name="/admin/system" class="org.apache.solr.handler.admin.SystemInfoHandler" />  
764 - <requestHandler name="/admin/plugins" class="org.apache.solr.handler.admin.PluginInfoHandler" />  
765 - <requestHandler name="/admin/threads" class="org.apache.solr.handler.admin.ThreadDumpHandler" />  
766 - <requestHandler name="/admin/properties" class="org.apache.solr.handler.admin.PropertiesRequestHandler" />  
767 - <requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" >  
768 -  
769 - If you wish to hide files under ${solr.home}/conf, explicitly register the ShowFileRequestHandler using:  
770 - <requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" >  
771 - <lst name="invariants">  
772 - <str name="hidden">synonyms.txt</str>  
773 - <str name="hidden">anotherfile.txt</str>  
774 - </lst>  
775 - </requestHandler>  
776 - -->  
777 - <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />  
778 -  
779 - <!-- ping/healthcheck -->  
780 - <requestHandler name="/admin/ping" class="PingRequestHandler">  
781 - <lst name="defaults">  
782 - <str name="qt">standard</str>  
783 - <str name="q">solrpingquery</str>  
784 - <str name="echoParams">all</str>  
785 - </lst>  
786 - </requestHandler>  
787 -  
788 - <!-- Echo the request contents back to the client -->  
789 - <requestHandler name="/debug/dump" class="solr.DumpRequestHandler" >  
790 - <lst name="defaults">  
791 - <str name="echoParams">explicit</str> <!-- for all params (including the default etc) use: 'all' -->  
792 - <str name="echoHandler">true</str>  
793 - </lst>  
794 - </requestHandler>  
795 -  
796 - <highlighting>  
797 - <!-- Configure the standard fragmenter -->  
798 - <!-- This could most likely be commented out in the "default" case -->  
799 - <fragmenter name="gap" class="org.apache.solr.highlight.GapFragmenter" default="true">  
800 - <lst name="defaults">  
801 - <int name="hl.fragsize">100</int>  
802 - </lst>  
803 - </fragmenter>  
804 -  
805 - <!-- A regular-expression-based fragmenter (f.i., for sentence extraction) -->  
806 - <fragmenter name="regex" class="org.apache.solr.highlight.RegexFragmenter">  
807 - <lst name="defaults">  
808 - <!-- slightly smaller fragsizes work better because of slop -->  
809 - <int name="hl.fragsize">70</int>  
810 - <!-- allow 50% slop on fragment sizes -->  
811 - <float name="hl.regex.slop">0.5</float>  
812 - <!-- a basic sentence pattern -->  
813 - <str name="hl.regex.pattern">[-\w ,/\n\"']{20,200}</str>  
814 - </lst>  
815 - </fragmenter>  
816 -  
817 - <!-- Configure the standard formatter -->  
818 - <formatter name="html" class="org.apache.solr.highlight.HtmlFormatter" default="true">  
819 - <lst name="defaults">  
820 - <str name="hl.simple.pre"><![CDATA[<em>]]></str>  
821 - <str name="hl.simple.post"><![CDATA[</em>]]></str>  
822 - </lst>  
823 - </formatter>  
824 - </highlighting>  
825 -  
826 - <!-- An example dedup update processor that creates the "id" field on the fly  
827 - based on the hash code of some other fields. This example has overwriteDupes  
828 - set to false since we are using the id field as the signatureField and Solr  
829 - will maintain uniqueness based on that anyway. -->  
830 - <!--  
831 - <updateRequestProcessorChain name="dedupe">  
832 - <processor class="org.apache.solr.update.processor.SignatureUpdateProcessorFactory">  
833 - <bool name="enabled">true</bool>  
834 - <str name="signatureField">id</str>  
835 - <bool name="overwriteDupes">false</bool>  
836 - <str name="fields">name,features,cat</str>  
837 - <str name="signatureClass">org.apache.solr.update.processor.Lookup3Signature</str>  
838 - </processor>  
839 - <processor class="solr.LogUpdateProcessorFactory" />  
840 - <processor class="solr.RunUpdateProcessorFactory" />  
841 - </updateRequestProcessorChain>  
842 - -->  
843 -  
844 -  
845 - <!-- queryResponseWriter plugins... query responses will be written using the  
846 - writer specified by the 'wt' request parameter matching the name of a registered  
847 - writer.  
848 - The "default" writer is the default and will be used if 'wt' is not specified  
849 - in the request. XMLResponseWriter will be used if nothing is specified here.  
850 - The json, python, and ruby writers are also available by default.  
851 -  
852 - <queryResponseWriter name="xml" class="org.apache.solr.request.XMLResponseWriter" default="true"/>  
853 - <queryResponseWriter name="json" class="org.apache.solr.request.JSONResponseWriter"/>  
854 - <queryResponseWriter name="python" class="org.apache.solr.request.PythonResponseWriter"/>  
855 - <queryResponseWriter name="ruby" class="org.apache.solr.request.RubyResponseWriter"/>  
856 - <queryResponseWriter name="php" class="org.apache.solr.request.PHPResponseWriter"/>  
857 - <queryResponseWriter name="phps" class="org.apache.solr.request.PHPSerializedResponseWriter"/>  
858 -  
859 - <queryResponseWriter name="custom" class="com.example.MyResponseWriter"/>  
860 - -->  
861 -  
862 - <requestHandler name="geo" class="org.apache.solr.handler.component.SearchHandler">  
863 - <arr name="components">  
864 - <str>mlt</str>  
865 - <str>highlight</str>  
866 - <str>debug</str>  
867 - </arr>  
868 - </requestHandler>  
869 -  
870 -  
871 -  
872 - <!-- XSLT response writer transforms the XML output by any xslt file found  
873 - in Solr's conf/xslt directory. Changes to xslt files are checked for  
874 - every xsltCacheLifetimeSeconds.  
875 - -->  
876 - <queryResponseWriter name="xslt" class="org.apache.solr.request.XSLTResponseWriter">  
877 - <int name="xsltCacheLifetimeSeconds">5</int>  
878 - </queryResponseWriter>  
879 -  
880 -  
881 - <!-- example of registering a query parser  
882 - <queryParser name="lucene" class="org.apache.solr.search.LuceneQParserPlugin"/>  
883 - -->  
884 -  
885 - <!-- example of registering a custom function parser  
886 - <valueSourceParser name="myfunc" class="com.mycompany.MyValueSourceParser" />  
887 - -->  
888 -  
889 - <!-- config for the admin interface -->  
890 - <admin>  
891 - <defaultQuery>solr</defaultQuery>  
892 -  
893 - <!-- configure a healthcheck file for servers behind a loadbalancer  
894 - <healthcheck type="file">server-enabled</healthcheck>  
895 - -->  
896 - </admin>  
897 -  
898 -</config> 1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!--
  3 + Licensed to the Apache Software Foundation (ASF) under one or more
  4 + contributor license agreements. See the NOTICE file distributed with
  5 + this work for additional information regarding copyright ownership.
  6 + The ASF licenses this file to You under the Apache License, Version 2.0
  7 + (the "License"); you may not use this file except in compliance with
  8 + the License. You may obtain a copy of the License at
  9 +
  10 + http://www.apache.org/licenses/LICENSE-2.0
  11 +
  12 + Unless required by applicable law or agreed to in writing, software
  13 + distributed under the License is distributed on an "AS IS" BASIS,
  14 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15 + See the License for the specific language governing permissions and
  16 + limitations under the License.
  17 +-->
  18 +
  19 +<!--
  20 + For more details about configurations options that may appear in
  21 + this file, see http://wiki.apache.org/solr/SolrConfigXml.
  22 +-->
  23 +<config>
  24 + <!-- In all configuration below, a prefix of "solr." for class names
  25 + is an alias that causes solr to search appropriate packages,
  26 + including org.apache.solr.(search|update|request|core|analysis)
  27 +
  28 + You may also specify a fully qualified Java classname if you
  29 + have your own custom plugins.
  30 + -->
  31 +
  32 + <!-- Set this to 'false' if you want solr to continue working after
  33 + it has encountered an severe configuration error. In a
  34 + production environment, you may want solr to keep working even
  35 + if one handler is mis-configured.
  36 +
  37 + You may also set this to false using by setting the system
  38 + property:
  39 +
  40 + -Dsolr.abortOnConfigurationError=false
  41 + -->
  42 + <abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
  43 +
  44 + <!-- Controls what version of Lucene various components of Solr
  45 + adhere to. Generally, you want to use the latest version to
  46 + get all bug fixes and improvements. It is highly recommended
  47 + that you fully re-index after changing this setting as it can
  48 + affect both how text is indexed and queried.
  49 + -->
  50 + <luceneMatchVersion>LUCENE_35</luceneMatchVersion>
  51 +
  52 + <!-- lib directives can be used to instruct Solr to load an Jars
  53 + identified and use them to resolve any "plugins" specified in
  54 + your solrconfig.xml or schema.xml (ie: Analyzers, Request
  55 + Handlers, etc...).
  56 +
  57 + All directories and paths are resolved relative to the
  58 + instanceDir.
  59 +
  60 + If a "./lib" directory exists in your instanceDir, all files
  61 + found in it are included as if you had used the following
  62 + syntax...
  63 +
  64 + <lib dir="./lib" />
  65 + -->
  66 +
  67 + <!-- A dir option by itself adds any files found in the directory to
  68 + the classpath, this is useful for including all jars in a
  69 + directory.
  70 + -->
  71 + <lib dir="../../contrib/extraction/lib" />
  72 + <lib dir="../../contrib/clustering/lib/" />
  73 + <lib dir="../../contrib/velocity/lib" />
  74 +
  75 + <!-- When a regex is specified in addition to a directory, only the
  76 + files in that directory which completely match the regex
  77 + (anchored on both ends) will be included.
  78 + -->
  79 + <lib dir="../../dist/" regex="apache-solr-cell-\d.*\.jar" />
  80 + <lib dir="../../dist/" regex="apache-solr-clustering-\d.*\.jar" />
  81 + <lib dir="../../dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" />
  82 + <lib dir="../../dist/" regex="apache-solr-langid-\d.*\.jar" />
  83 + <lib dir="../../dist/" regex="apache-solr-velocity-\d.*\.jar" />
  84 +
  85 + <!-- If a dir option (with or without a regex) is used and nothing
  86 + is found that matches, it will be ignored
  87 + -->
  88 + <lib dir="../../contrib/clustering/lib/" />
  89 + <lib dir="/total/crap/dir/ignored" />
  90 +
  91 + <!-- an exact path can be used to specify a specific file. This
  92 + will cause a serious error to be logged if it can't be loaded.
  93 + -->
  94 + <!--
  95 + <lib path="../a-jar-that-does-not-exist.jar" />
  96 + -->
  97 +
  98 + <!-- Data Directory
  99 +
  100 + Used to specify an alternate directory to hold all index data
  101 + other than the default ./data under the Solr home. If
  102 + replication is in use, this should match the replication
  103 + configuration.
  104 + -->
  105 + <dataDir>${solr.data.dir:}</dataDir>
  106 +
  107 +
  108 + <!-- The DirectoryFactory to use for indexes.
  109 +
  110 + solr.StandardDirectoryFactory, the default, is filesystem
  111 + based and tries to pick the best implementation for the current
  112 + JVM and platform. One can force a particular implementation
  113 + via solr.MMapDirectoryFactory, solr.NIOFSDirectoryFactory, or
  114 + solr.SimpleFSDirectoryFactory.
  115 +
  116 + solr.RAMDirectoryFactory is memory based, not
  117 + persistent, and doesn't work with replication.
  118 + -->
  119 + <directoryFactory name="DirectoryFactory"
  120 + class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
  121 +
  122 +
  123 + <!-- Index Defaults
  124 +
  125 + Values here affect all index writers and act as a default
  126 + unless overridden.
  127 +
  128 + WARNING: See also the <mainIndex> section below for parameters
  129 + that overfor Solr's main Lucene index.
  130 + -->
  131 + <indexDefaults>
  132 +
  133 + <useCompoundFile>false</useCompoundFile>
  134 +
  135 + <mergeFactor>10</mergeFactor>
  136 + <!-- Sets the amount of RAM that may be used by Lucene indexing
  137 + for buffering added documents and deletions before they are
  138 + flushed to the Directory. -->
  139 + <ramBufferSizeMB>128</ramBufferSizeMB>
  140 + <!-- If both ramBufferSizeMB and maxBufferedDocs is set, then
  141 + Lucene will flush based on whichever limit is hit first.
  142 + -->
  143 + <maxBufferedDocs>1000</maxBufferedDocs> -->
  144 +
  145 + <maxFieldLength>1001001</maxFieldLength>
  146 + <writeLockTimeout>1000</writeLockTimeout>
  147 +
  148 + <!-- Expert: Merge Policy
  149 +
  150 + The Merge Policy in Lucene controls how merging is handled by
  151 + Lucene. The default in Solr 3.3 is TieredMergePolicy.
  152 +
  153 + The default in 2.3 was the LogByteSizeMergePolicy,
  154 + previous versions used LogDocMergePolicy.
  155 +
  156 + LogByteSizeMergePolicy chooses segments to merge based on
  157 + their size. The Lucene 2.2 default, LogDocMergePolicy chose
  158 + when to merge based on number of documents
  159 +
  160 + Other implementations of MergePolicy must have a no-argument
  161 + constructor
  162 + -->
  163 + <!--
  164 + <mergePolicy class="org.apache.lucene.index.TieredMergePolicy"/>
  165 + -->
  166 +
  167 + <!-- Expert: Merge Scheduler
  168 +
  169 + The Merge Scheduler in Lucene controls how merges are
  170 + performed. The ConcurrentMergeScheduler (Lucene 2.3 default)
  171 + can perform merges in the background using separate threads.
  172 + The SerialMergeScheduler (Lucene 2.2 default) does not.
  173 + -->
  174 + <!--
  175 + <mergeScheduler class="org.apache.lucene.index.ConcurrentMergeScheduler"/>
  176 + -->
  177 +
  178 + <!-- LockFactory
  179 +
  180 + This option specifies which Lucene LockFactory implementation
  181 + to use.
  182 +
  183 + single = SingleInstanceLockFactory - suggested for a
  184 + read-only index or when there is no possibility of
  185 + another process trying to modify the index.
  186 + native = NativeFSLockFactory - uses OS native file locking.
  187 + Do not use when multiple solr webapps in the same
  188 + JVM are attempting to share a single index.
  189 + simple = SimpleFSLockFactory - uses a plain file for locking
  190 +
  191 + (For backwards compatibility with Solr 1.2, 'simple' is the
  192 + default if not specified.)
  193 +
  194 + More details on the nuances of each LockFactory...
  195 + http://wiki.apache.org/lucene-java/AvailableLockFactories
  196 + -->
  197 + <lockType>native</lockType>
  198 +
  199 + <!-- Expert: Controls how often Lucene loads terms into memory
  200 + Default is 128 and is likely good for most everyone.
  201 + -->
  202 + <!-- <termIndexInterval>256</termIndexInterval> -->
  203 + </indexDefaults>
  204 +
  205 + <!-- Main Index
  206 +
  207 + Values here override the values in the <indexDefaults> section
  208 + for the main on disk index.
  209 + -->
  210 + <mainIndex>
  211 +
  212 + <mergeFactor>10</mergeFactor>
  213 + <!-- Sets the amount of RAM that may be used by Lucene indexing
  214 + for buffering added documents and deletions before they are
  215 + flushed to the Directory. -->
  216 + <ramBufferSizeMB>128</ramBufferSizeMB>
  217 + <!-- If both ramBufferSizeMB and maxBufferedDocs is set, then
  218 + Lucene will flush based on whichever limit is hit first.
  219 + -->
  220 + <maxBufferedDocs>1000</maxBufferedDocs> -->
  221 +
  222 + <!-- Unlock On Startup
  223 +
  224 + If true, unlock any held write or commit locks on startup.
  225 + This defeats the locking mechanism that allows multiple
  226 + processes to safely access a lucene index, and should be used
  227 + with care.
  228 +
  229 + This is not needed if lock type is 'none' or 'single'
  230 + -->
  231 + <unlockOnStartup>false</unlockOnStartup>
  232 +
  233 + <!-- If true, IndexReaders will be reopened (often more efficient)
  234 + instead of closed and then opened.
  235 + -->
  236 + <reopenReaders>true</reopenReaders>
  237 +
  238 + <!-- Commit Deletion Policy
  239 +
  240 + Custom deletion policies can specified here. The class must
  241 + implement org.apache.lucene.index.IndexDeletionPolicy.
  242 +
  243 + http://lucene.apache.org/java/2_9_1/api/all/org/apache/lucene/index/IndexDeletionPolicy.html
  244 +
  245 + The standard Solr IndexDeletionPolicy implementation supports
  246 + deleting index commit points on number of commits, age of
  247 + commit point and optimized status.
  248 +
  249 + The latest commit point should always be preserved regardless
  250 + of the criteria.
  251 + -->
  252 + <deletionPolicy class="solr.SolrDeletionPolicy">
  253 + <!-- The number of commit points to be kept -->
  254 + <str name="maxCommitsToKeep">1</str>
  255 + <!-- The number of optimized commit points to be kept -->
  256 + <str name="maxOptimizedCommitsToKeep">0</str>
  257 + <!--
  258 + Delete all commit points once they have reached the given age.
  259 + Supports DateMathParser syntax e.g.
  260 + -->
  261 + <!--
  262 + <str name="maxCommitAge">30MINUTES</str>
  263 + <str name="maxCommitAge">1DAY</str>
  264 + -->
  265 + </deletionPolicy>
  266 +
  267 + <!-- Lucene Infostream
  268 +
  269 + To aid in advanced debugging, Lucene provides an "InfoStream"
  270 + of detailed information when indexing.
  271 +
  272 + Setting The value to true will instruct the underlying Lucene
  273 + IndexWriter to write its debugging info the specified file
  274 + -->
  275 + <infoStream file="INFOSTREAM.txt">false</infoStream>
  276 +
  277 + </mainIndex>
  278 +
  279 + <!-- JMX
  280 +
  281 + This example enables JMX if and only if an existing MBeanServer
  282 + is found, use this if you want to configure JMX through JVM
  283 + parameters. Remove this to disable exposing Solr configuration
  284 + and statistics to JMX.
  285 +
  286 + For more details see http://wiki.apache.org/solr/SolrJmx
  287 + -->
  288 + <jmx />
  289 + <!-- If you want to connect to a particular server, specify the
  290 + agentId
  291 + -->
  292 + <!-- <jmx agentId="myAgent" /> -->
  293 + <!-- If you want to start a new MBeanServer, specify the serviceUrl -->
  294 + <!-- <jmx serviceUrl="service:jmx:rmi:///jndi/rmi://localhost:9999/solr"/>
  295 + -->
  296 +
  297 + <!-- The default high-performance update handler -->
  298 + <updateHandler class="solr.DirectUpdateHandler2">
  299 +
  300 + <!-- AutoCommit
  301 +
  302 + Perform a <commit/> automatically under certain conditions.
  303 + Instead of enabling autoCommit, consider using "commitWithin"
  304 + when adding documents.
  305 +
  306 + http://wiki.apache.org/solr/UpdateXmlMessages
  307 +
  308 + maxDocs - Maximum number of documents to add since the last
  309 + commit before automatically triggering a new commit.
  310 +
  311 + maxTime - Maximum amount of time that is allowed to pass
  312 + since a document was added before automaticly
  313 + triggering a new commit.
  314 + -->
  315 + <autoCommit>
  316 + <maxDocs>1000</maxDocs>
  317 + <maxTime>1800000</maxTime>
  318 + </autoCommit>
  319 +
  320 + <!-- Update Related Event Listeners
  321 +
  322 + Various IndexWriter related events can trigger Listeners to
  323 + take actions.
  324 +
  325 + postCommit - fired after every commit or optimize command
  326 + postOptimize - fired after every optimize command
  327 + -->
  328 + <!-- The RunExecutableListener executes an external command from a
  329 + hook such as postCommit or postOptimize.
  330 +
  331 + exe - the name of the executable to run
  332 + dir - dir to use as the current working directory. (default=".")
  333 + wait - the calling thread waits until the executable returns.
  334 + (default="true")
  335 + args - the arguments to pass to the program. (default is none)
  336 + env - environment variables to set. (default is none)
  337 + -->
  338 + <!-- This example shows how RunExecutableListener could be used
  339 + with the script based replication...
  340 + http://wiki.apache.org/solr/CollectionDistribution
  341 + -->
  342 + <!--
  343 + <listener event="postCommit" class="solr.RunExecutableListener">
  344 + <str name="exe">solr/bin/snapshooter</str>
  345 + <str name="dir">.</str>
  346 + <bool name="wait">true</bool>
  347 + <arr name="args"> <str>arg1</str> <str>arg2</str> </arr>
  348 + <arr name="env"> <str>MYVAR=val1</str> </arr>
  349 + </listener>
  350 + -->
  351 + </updateHandler>
  352 +
  353 + <!-- IndexReaderFactory
  354 +
  355 + Use the following format to specify a custom IndexReaderFactory,
  356 + which allows for alternate IndexReader implementations.
  357 +
  358 + ** Experimental Feature **
  359 +
  360 + Please note - Using a custom IndexReaderFactory may prevent
  361 + certain other features from working. The API to
  362 + IndexReaderFactory may change without warning or may even be
  363 + removed from future releases if the problems cannot be
  364 + resolved.
  365 +
  366 +
  367 + ** Features that may not work with custom IndexReaderFactory **
  368 +
  369 + The ReplicationHandler assumes a disk-resident index. Using a
  370 + custom IndexReader implementation may cause incompatibility
  371 + with ReplicationHandler and may cause replication to not work
  372 + correctly. See SOLR-1366 for details.
  373 +
  374 + -->
  375 + <!--
  376 + <indexReaderFactory name="IndexReaderFactory" class="package.class">
  377 + <str name="someArg">Some Value</str>
  378 + </indexReaderFactory >
  379 + -->
  380 + <!-- By explicitly declaring the Factory, the termIndexDivisor can
  381 + be specified.
  382 + -->
  383 + <!--
  384 + <indexReaderFactory name="IndexReaderFactory"
  385 + class="solr.StandardIndexReaderFactory">
  386 + <int name="setTermIndexDivisor">12</int>
  387 + </indexReaderFactory >
  388 + -->
  389 +
  390 +
  391 + <query>
  392 + <!-- Max Boolean Clauses
  393 +
  394 + Maximum number of clauses in each BooleanQuery, an exception
  395 + is thrown if exceeded.
  396 +
  397 + ** WARNING **
  398 +
  399 + This option actually modifies a global Lucene property that
  400 + will affect all SolrCores. If multiple solrconfig.xml files
  401 + disagree on this property, the value at any given moment will
  402 + be based on the last SolrCore to be initialized.
  403 +
  404 + -->
  405 + <maxBooleanClauses>1024</maxBooleanClauses>
  406 +
  407 +
  408 + <!-- Solr Internal Query Caches
  409 +
  410 + There are two implementations of cache available for Solr,
  411 + LRUCache, based on a synchronized LinkedHashMap, and
  412 + FastLRUCache, based on a ConcurrentHashMap.
  413 +
  414 + FastLRUCache has faster gets and slower puts in single
  415 + threaded operation and thus is generally faster than LRUCache
  416 + when the hit ratio of the cache is high (> 75%), and may be
  417 + faster under other scenarios on multi-cpu systems.
  418 + -->
  419 +
  420 + <!-- Filter Cache
  421 +
  422 + Cache used by SolrIndexSearcher for filters (DocSets),
  423 + unordered sets of *all* documents that match a query. When a
  424 + new searcher is opened, its caches may be prepopulated or
  425 + "autowarmed" using data from caches in the old searcher.
  426 + autowarmCount is the number of items to prepopulate. For
  427 + LRUCache, the autowarmed items will be the most recently
  428 + accessed items.
  429 +
  430 + Parameters:
  431 + class - the SolrCache implementation LRUCache or
  432 + (LRUCache or FastLRUCache)
  433 + size - the maximum number of entries in the cache
  434 + initialSize - the initial capacity (number of entries) of
  435 + the cache. (see java.util.HashMap)
  436 + autowarmCount - the number of entries to prepopulate from
  437 + and old cache.
  438 + -->
  439 + <filterCache class="solr.FastLRUCache"
  440 + size="512"
  441 + initialSize="512"
  442 + autowarmCount="0"/>
  443 +
  444 + <!-- Query Result Cache
  445 +
  446 + Caches results of searches - ordered lists of document ids
  447 + (DocList) based on a query, a sort, and the range of documents requested.
  448 + -->
  449 + <queryResultCache class="solr.LRUCache"
  450 + size="512"
  451 + initialSize="512"
  452 + autowarmCount="0"/>
  453 +
  454 + <!-- Document Cache
  455 +
  456 + Caches Lucene Document objects (the stored fields for each
  457 + document). Since Lucene internal document ids are transient,
  458 + this cache will not be autowarmed.
  459 + -->
  460 + <documentCache class="solr.LRUCache"
  461 + size="512"
  462 + initialSize="512"
  463 + autowarmCount="0"/>
  464 +
  465 + <!-- Field Value Cache
  466 +
  467 + Cache used to hold field values that are quickly accessible
  468 + by document id. The fieldValueCache is created by default
  469 + even if not configured here.
  470 + -->
  471 + <!--
  472 + <fieldValueCache class="solr.FastLRUCache"
  473 + size="512"
  474 + autowarmCount="128"
  475 + showItems="32" />
  476 + -->
  477 +
  478 + <!-- Custom Cache
  479 +
  480 + Example of a generic cache. These caches may be accessed by
  481 + name through SolrIndexSearcher.getCache(),cacheLookup(), and
  482 + cacheInsert(). The purpose is to enable easy caching of
  483 + user/application level data. The regenerator argument should
  484 + be specified as an implementation of solr.CacheRegenerator
  485 + if autowarming is desired.
  486 + -->
  487 + <!--
  488 + <cache name="myUserCache"
  489 + class="solr.LRUCache"
  490 + size="4096"
  491 + initialSize="1024"
  492 + autowarmCount="1024"
  493 + regenerator="com.mycompany.MyRegenerator"
  494 + />
  495 + -->
  496 +
  497 +
  498 + <!-- Lazy Field Loading
  499 +
  500 + If true, stored fields that are not requested will be loaded
  501 + lazily. This can result in a significant speed improvement
  502 + if the usual case is to not load all stored fields,
  503 + especially if the skipped fields are large compressed text
  504 + fields.
  505 + -->
  506 + <enableLazyFieldLoading>true</enableLazyFieldLoading>
  507 +
  508 + <!-- Use Filter For Sorted Query
  509 +
  510 + A possible optimization that attempts to use a filter to
  511 + satisfy a search. If the requested sort does not include
  512 + score, then the filterCache will be checked for a filter
  513 + matching the query. If found, the filter will be used as the
  514 + source of document ids, and then the sort will be applied to
  515 + that.
  516 +
  517 + For most situations, this will not be useful unless you
  518 + frequently get the same search repeatedly with different sort
  519 + options, and none of them ever use "score"
  520 + -->
  521 + <!--
  522 + <useFilterForSortedQuery>true</useFilterForSortedQuery>
  523 + -->
  524 +
  525 + <!-- Result Window Size
  526 +
  527 + An optimization for use with the queryResultCache. When a search
  528 + is requested, a superset of the requested number of document ids
  529 + are collected. For example, if a search for a particular query
  530 + requests matching documents 10 through 19, and queryWindowSize is 50,
  531 + then documents 0 through 49 will be collected and cached. Any further
  532 + requests in that range can be satisfied via the cache.
  533 + -->
  534 + <queryResultWindowSize>20</queryResultWindowSize>
  535 +
  536 + <!-- Maximum number of documents to cache for any entry in the
  537 + queryResultCache.
  538 + -->
  539 + <queryResultMaxDocsCached>200</queryResultMaxDocsCached>
  540 +
  541 + <!-- Query Related Event Listeners
  542 +
  543 + Various IndexSearcher related events can trigger Listeners to
  544 + take actions.
  545 +
  546 + newSearcher - fired whenever a new searcher is being prepared
  547 + and there is a current searcher handling requests (aka
  548 + registered). It can be used to prime certain caches to
  549 + prevent long request times for certain requests.
  550 +
  551 + firstSearcher - fired whenever a new searcher is being
  552 + prepared but there is no current registered searcher to handle
  553 + requests or to gain autowarming data from.
  554 +
  555 +
  556 + -->
  557 + <!-- QuerySenderListener takes an array of NamedList and executes a
  558 + local query request for each NamedList in sequence.
  559 + -->
  560 + <listener event="newSearcher" class="solr.QuerySenderListener">
  561 + <arr name="queries">
  562 + <!--
  563 + <lst><str name="q">solr</str><str name="sort">price asc</str></lst>
  564 + <lst><str name="q">rocks</str><str name="sort">weight asc</str></lst>
  565 + -->
  566 + </arr>
  567 + </listener>
  568 + <listener event="firstSearcher" class="solr.QuerySenderListener">
  569 + <arr name="queries">
  570 + <lst>
  571 + <str name="q">static firstSearcher warming in solrconfig.xml</str>
  572 + </lst>
  573 + </arr>
  574 + </listener>
  575 +
  576 + <!-- Use Cold Searcher
  577 +
  578 + If a search request comes in and there is no current
  579 + registered searcher, then immediately register the still
  580 + warming searcher and use it. If "false" then all requests
  581 + will block until the first searcher is done warming.
  582 + -->
  583 + <useColdSearcher>false</useColdSearcher>
  584 +
  585 + <!-- Max Warming Searchers
  586 +
  587 + Maximum number of searchers that may be warming in the
  588 + background concurrently. An error is returned if this limit
  589 + is exceeded.
  590 +
  591 + Recommend values of 1-2 for read-only slaves, higher for
  592 + masters w/o cache warming.
  593 + -->
  594 + <maxWarmingSearchers>4</maxWarmingSearchers>
  595 +
  596 + </query>
  597 +
  598 +
  599 + <!-- Request Dispatcher
  600 +
  601 + This section contains instructions for how the SolrDispatchFilter
  602 + should behave when processing requests for this SolrCore.
  603 +
  604 + handleSelect affects the behavior of requests such as /select?qt=XXX
  605 +
  606 + handleSelect="true" will cause the SolrDispatchFilter to process
  607 + the request and will result in consistent error handling and
  608 + formatting for all types of requests.
  609 +
  610 + handleSelect="false" will cause the SolrDispatchFilter to
  611 + ignore "/select" requests and fallback to using the legacy
  612 + SolrServlet and it's Solr 1.1 style error formatting
  613 + -->
  614 + <requestDispatcher handleSelect="true" >
  615 + <!-- Request Parsing
  616 +
  617 + These settings indicate how Solr Requests may be parsed, and
  618 + what restrictions may be placed on the ContentStreams from
  619 + those requests
  620 +
  621 + enableRemoteStreaming - enables use of the stream.file
  622 + and stream.url parameters for specifying remote streams.
  623 +
  624 + multipartUploadLimitInKB - specifies the max size of
  625 + Multipart File Uploads that Solr will allow in a Request.
  626 +
  627 + *** WARNING ***
  628 + The settings below authorize Solr to fetch remote files, You
  629 + should make sure your system has some authentication before
  630 + using enableRemoteStreaming="true"
  631 +
  632 + -->
  633 + <requestParsers enableRemoteStreaming="true"
  634 + multipartUploadLimitInKB="2048000" />
  635 +
  636 + <!-- HTTP Caching
  637 +
  638 + Set HTTP caching related parameters (for proxy caches and clients).
  639 +
  640 + The options below instruct Solr not to output any HTTP Caching
  641 + related headers
  642 + -->
  643 + <httpCaching never304="true" />
  644 + <!-- If you include a <cacheControl> directive, it will be used to
  645 + generate a Cache-Control header (as well as an Expires header
  646 + if the value contains "max-age=")
  647 +
  648 + By default, no Cache-Control header is generated.
  649 +
  650 + You can use the <cacheControl> option even if you have set
  651 + never304="true"
  652 + -->
  653 + <!--
  654 + <httpCaching never304="true" >
  655 + <cacheControl>max-age=30, public</cacheControl>
  656 + </httpCaching>
  657 + -->
  658 + <!-- To enable Solr to respond with automatically generated HTTP
  659 + Caching headers, and to response to Cache Validation requests
  660 + correctly, set the value of never304="false"
  661 +
  662 + This will cause Solr to generate Last-Modified and ETag
  663 + headers based on the properties of the Index.
  664 +
  665 + The following options can also be specified to affect the
  666 + values of these headers...
  667 +
  668 + lastModFrom - the default value is "openTime" which means the
  669 + Last-Modified value (and validation against If-Modified-Since
  670 + requests) will all be relative to when the current Searcher
  671 + was opened. You can change it to lastModFrom="dirLastMod" if
  672 + you want the value to exactly correspond to when the physical
  673 + index was last modified.
  674 +
  675 + etagSeed="..." is an option you can change to force the ETag
  676 + header (and validation against If-None-Match requests) to be
  677 + different even if the index has not changed (ie: when making
  678 + significant changes to your config file)
  679 +
  680 + (lastModifiedFrom and etagSeed are both ignored if you use
  681 + the never304="true" option)
  682 + -->
  683 + <!--
  684 + <httpCaching lastModifiedFrom="openTime"
  685 + etagSeed="Solr">
  686 + <cacheControl>max-age=30, public</cacheControl>
  687 + </httpCaching>
  688 + -->
  689 + </requestDispatcher>
  690 +
  691 + <!-- Request Handlers
  692 +
  693 + http://wiki.apache.org/solr/SolrRequestHandler
  694 +
  695 + incoming queries will be dispatched to the correct handler
  696 + based on the path or the qt (query type) param.
  697 +
  698 + Names starting with a '/' are accessed with the a path equal to
  699 + the registered name. Names without a leading '/' are accessed
  700 + with: http://host/app/[core/]select?qt=name
  701 +
  702 + If a /select request is processed with out a qt param
  703 + specified, the requestHandler that declares default="true" will
  704 + be used.
  705 +
  706 + If a Request Handler is declared with startup="lazy", then it will
  707 + not be initialized until the first request that uses it.
  708 +
  709 + -->
  710 + <!-- SearchHandler
  711 +
  712 + http://wiki.apache.org/solr/SearchHandler
  713 +
  714 + For processing Search Queries, the primary Request Handler
  715 + provided with Solr is "SearchHandler" It delegates to a sequent
  716 + of SearchComponents (see below) and supports distributed
  717 + queries across multiple shards
  718 + -->
  719 + <requestHandler name="search" class="solr.SearchHandler" default="true">
  720 + <!-- default values for query parameters can be specified, these
  721 + will be overridden by parameters in the request
  722 + -->
  723 + <lst name="defaults">
  724 + <str name="echoParams">none</str>
  725 + <int name="rows">10</int>
  726 + </lst>
  727 + <!-- In addition to defaults, "appends" params can be specified
  728 + to identify values which should be appended to the list of
  729 + multi-val params from the query (or the existing "defaults").
  730 + -->
  731 + <!-- In this example, the param "fq=instock:true" would be appended to
  732 + any query time fq params the user may specify, as a mechanism for
  733 + partitioning the index, independent of any user selected filtering
  734 + that may also be desired (perhaps as a result of faceted searching).
  735 +
  736 + NOTE: there is *absolutely* nothing a client can do to prevent these
  737 + "appends" values from being used, so don't use this mechanism
  738 + unless you are sure you always want it.
  739 + -->
  740 + <!--
  741 + <lst name="appends">
  742 + <str name="fq">inStock:true</str>
  743 + </lst>
  744 + -->
  745 + <!-- "invariants" are a way of letting the Solr maintainer lock down
  746 + the options available to Solr clients. Any params values
  747 + specified here are used regardless of what values may be specified
  748 + in either the query, the "defaults", or the "appends" params.
  749 +
  750 + In this example, the facet.field and facet.query params would
  751 + be fixed, limiting the facets clients can use. Faceting is
  752 + not turned on by default - but if the client does specify
  753 + facet=true in the request, these are the only facets they
  754 + will be able to see counts for; regardless of what other
  755 + facet.field or facet.query params they may specify.
  756 +
  757 + NOTE: there is *absolutely* nothing a client can do to prevent these
  758 + "invariants" values from being used, so don't use this mechanism
  759 + unless you are sure you always want it.
  760 + -->
  761 + <!--
  762 + <lst name="invariants">
  763 + <str name="facet.field">cat</str>
  764 + <str name="facet.field">manu_exact</str>
  765 + <str name="facet.query">price:[* TO 500]</str>
  766 + <str name="facet.query">price:[500 TO *]</str>
  767 + </lst>
  768 + -->
  769 + <!-- If the default list of SearchComponents is not desired, that
  770 + list can either be overridden completely, or components can be
  771 + prepended or appended to the default list. (see below)
  772 + -->
  773 + <!--
  774 + <arr name="components">
  775 + <str>nameOfCustomComponent1</str>
  776 + <str>nameOfCustomComponent2</str>
  777 + </arr>
  778 + -->
  779 + </requestHandler>
  780 +
  781 + <!-- DisMaxRequestHandler allows easy searching across multiple fields
  782 + for simple user-entered phrases. It's implementation is now
  783 + just the standard SearchHandler with a default query type
  784 + of "dismax".
  785 + see http://wiki.apache.org/solr/DisMaxRequestHandler
  786 + -->
  787 + <requestHandler name="dismax" class="solr.SearchHandler" >
  788 + <lst name="defaults">
  789 + <str name="defType">edismax</str>
  790 + <str name="echoParams">none</str>
  791 +
  792 + <!-- Highlighting defaults -->
  793 + <str name="hl">on</str>
  794 + <str name="hl.fl">text features name</str>
  795 + <str name="f.name.hl.fragsize">0</str>
  796 + <str name="f.name.hl.alternateField">name</str>
  797 + </lst>
  798 + </requestHandler>
  799 +
  800 + <!-- A Robust Example
  801 +
  802 + This example SearchHandler declaration shows off usage of the
  803 + SearchHandler with many defaults declared
  804 +
  805 + Note that multiple instances of the same Request Handler
  806 + (SearchHandler) can be registered multiple times with different
  807 + names (and different init parameters)
  808 + -->
  809 + <requestHandler name="/browse" class="solr.SearchHandler">
  810 + <lst name="defaults">
  811 + <str name="echoParams">none</str>
  812 +
  813 + <!-- VelocityResponseWriter settings -->
  814 + <str name="wt">velocity</str>
  815 +
  816 + <str name="v.template">browse</str>
  817 + <str name="v.layout">layout</str>
  818 +
  819 + <str name="defType">edismax</str>
  820 + <str name="rows">10</str>
  821 + <str name="fl">*,score</str>
  822 +
  823 + <!-- Highlighting defaults -->
  824 + <str name="hl">on</str>
  825 + <str name="hl.fl">text features name</str>
  826 + <str name="f.name.hl.fragsize">0</str>
  827 + <str name="f.name.hl.alternateField">name</str>
  828 + </lst>
  829 + <arr name="last-components">
  830 + <str>spellcheck</str>
  831 + </arr>
  832 + <!--
  833 + <str name="url-scheme">httpx</str>
  834 + -->
  835 + </requestHandler>
  836 +
  837 + <!-- XML Update Request Handler.
  838 +
  839 + http://wiki.apache.org/solr/UpdateXmlMessages
  840 +
  841 + The canonical Request Handler for Modifying the Index through
  842 + commands specified using XML.
  843 +
  844 + Note: Since solr1.1 requestHandlers requires a valid content
  845 + type header if posted in the body. For example, curl now
  846 + requires: -H 'Content-type:text/xml; charset=utf-8'
  847 + -->
  848 + <requestHandler name="/update"
  849 + class="solr.XmlUpdateRequestHandler">
  850 + <!-- See below for information on defining
  851 + updateRequestProcessorChains that can be used by name
  852 + on each Update Request
  853 + -->
  854 + <!--
  855 + <lst name="defaults">
  856 + <str name="update.chain">dedupe</str>
  857 + </lst>
  858 + -->
  859 + </requestHandler>
  860 + <!-- Binary Update Request Handler
  861 + http://wiki.apache.org/solr/javabin
  862 + -->
  863 + <requestHandler name="/update/javabin"
  864 + class="solr.BinaryUpdateRequestHandler" />
  865 +
  866 + <!-- CSV Update Request Handler
  867 + http://wiki.apache.org/solr/UpdateCSV
  868 + -->
  869 + <requestHandler name="/update/csv"
  870 + class="solr.CSVRequestHandler"
  871 + startup="lazy" />
  872 +
  873 + <!-- JSON Update Request Handler
  874 + http://wiki.apache.org/solr/UpdateJSON
  875 + -->
  876 + <requestHandler name="/update/json"
  877 + class="solr.JsonUpdateRequestHandler"
  878 + startup="lazy" />
  879 +
  880 + <!-- Solr Cell Update Request Handler
  881 +
  882 + http://wiki.apache.org/solr/ExtractingRequestHandler
  883 +
  884 + -->
  885 + <requestHandler name="/update/extract"
  886 + startup="lazy"
  887 + class="solr.extraction.ExtractingRequestHandler" >
  888 + <lst name="defaults">
  889 + <!-- All the main content goes into "text"... if you need to return
  890 + the extracted text or do highlighting, use a stored field. -->
  891 + <str name="fmap.content">text</str>
  892 + <str name="lowernames">true</str>
  893 + <str name="uprefix">ignored_</str>
  894 +
  895 + <!-- capture link hrefs but ignore div attributes -->
  896 + <str name="captureAttr">true</str>
  897 + <str name="fmap.a">links</str>
  898 + <str name="fmap.div">ignored_</str>
  899 + </lst>
  900 + </requestHandler>
  901 +
  902 + <!-- XSLT Update Request Handler
  903 + Transforms incoming XML with stylesheet identified by tr=
  904 + -->
  905 + <requestHandler name="/update/xslt"
  906 + startup="lazy"
  907 + class="solr.XsltUpdateRequestHandler"/>
  908 +
  909 + <!-- Field Analysis Request Handler
  910 +
  911 + RequestHandler that provides much the same functionality as
  912 + analysis.jsp. Provides the ability to specify multiple field
  913 + types and field names in the same request and outputs
  914 + index-time and query-time analysis for each of them.
  915 +
  916 + Request parameters are:
  917 + analysis.fieldname - field name whose analyzers are to be used
  918 +
  919 + analysis.fieldtype - field type whose analyzers are to be used
  920 + analysis.fieldvalue - text for index-time analysis
  921 + q (or analysis.q) - text for query time analysis
  922 + analysis.showmatch (true|false) - When set to true and when
  923 + query analysis is performed, the produced tokens of the
  924 + field value analysis will be marked as "matched" for every
  925 + token that is produces by the query analysis
  926 + -->
  927 + <requestHandler name="/analysis/field"
  928 + startup="lazy"
  929 + class="solr.FieldAnalysisRequestHandler" />
  930 +
  931 +
  932 + <!-- Document Analysis Handler
  933 +
  934 + http://wiki.apache.org/solr/AnalysisRequestHandler
  935 +
  936 + An analysis handler that provides a breakdown of the analysis
  937 + process of provided docuemnts. This handler expects a (single)
  938 + content stream with the following format:
  939 +
  940 + <docs>
  941 + <doc>
  942 + <field name="id">1</field>
  943 + <field name="name">The Name</field>
  944 + <field name="text">The Text Value</field>
  945 + </doc>
  946 + <doc>...</doc>
  947 + <doc>...</doc>
  948 + ...
  949 + </docs>
  950 +
  951 + Note: Each document must contain a field which serves as the
  952 + unique key. This key is used in the returned response to associate
  953 + an analysis breakdown to the analyzed document.
  954 +
  955 + Like the FieldAnalysisRequestHandler, this handler also supports
  956 + query analysis by sending either an "analysis.query" or "q"
  957 + request parameter that holds the query text to be analyzed. It
  958 + also supports the "analysis.showmatch" parameter which when set to
  959 + true, all field tokens that match the query tokens will be marked
  960 + as a "match".
  961 + -->
  962 + <requestHandler name="/analysis/document"
  963 + class="solr.DocumentAnalysisRequestHandler"
  964 + startup="lazy" />
  965 +
  966 + <!-- Admin Handlers
  967 +
  968 + Admin Handlers - This will register all the standard admin
  969 + RequestHandlers.
  970 + -->
  971 + <requestHandler name="/admin/"
  972 + class="solr.admin.AdminHandlers" />
  973 + <!-- This single handler is equivalent to the following... -->
  974 + <!--
  975 + <requestHandler name="/admin/luke" class="solr.admin.LukeRequestHandler" />
  976 + <requestHandler name="/admin/system" class="solr.admin.SystemInfoHandler" />
  977 + <requestHandler name="/admin/plugins" class="solr.admin.PluginInfoHandler" />
  978 + <requestHandler name="/admin/threads" class="solr.admin.ThreadDumpHandler" />
  979 + <requestHandler name="/admin/properties" class="solr.admin.PropertiesRequestHandler" />
  980 + <requestHandler name="/admin/file" class="solr.admin.ShowFileRequestHandler" >
  981 + -->
  982 + <!-- If you wish to hide files under ${solr.home}/conf, explicitly
  983 + register the ShowFileRequestHandler using:
  984 + -->
  985 + <!--
  986 + <requestHandler name="/admin/file"
  987 + class="solr.admin.ShowFileRequestHandler" >
  988 + <lst name="invariants">
  989 + <str name="hidden">synonyms.txt</str>
  990 + <str name="hidden">anotherfile.txt</str>
  991 + </lst>
  992 + </requestHandler>
  993 + -->
  994 +
  995 + <!-- ping/healthcheck -->
  996 + <requestHandler name="/admin/ping" class="solr.PingRequestHandler">
  997 + <lst name="invariants">
  998 + <str name="qt">search</str>
  999 + <str name="q">solrpingquery</str>
  1000 + </lst>
  1001 + <lst name="defaults">
  1002 + <str name="echoParams">all</str>
  1003 + </lst>
  1004 + </requestHandler>
  1005 +
  1006 + <!-- Echo the request contents back to the client -->
  1007 + <requestHandler name="/debug/dump" class="solr.DumpRequestHandler" >
  1008 + <lst name="defaults">
  1009 + <str name="echoParams">explicit</str>
  1010 + <str name="echoHandler">true</str>
  1011 + </lst>
  1012 + </requestHandler>
  1013 +
  1014 + <!-- Solr Replication
  1015 +
  1016 + The SolrReplicationHandler supports replicating indexes from a
  1017 + "master" used for indexing and "salves" used for queries.
  1018 +
  1019 + http://wiki.apache.org/solr/SolrReplication
  1020 +
  1021 + In the example below, remove the <lst name="master"> section if
  1022 + this is just a slave and remove the <lst name="slave"> section
  1023 + if this is just a master.
  1024 + -->
  1025 + <!--
  1026 + <requestHandler name="/replication" class="solr.ReplicationHandler" >
  1027 + <lst name="master">
  1028 + <str name="replicateAfter">commit</str>
  1029 + <str name="replicateAfter">startup</str>
  1030 + <str name="confFiles">schema.xml,stopwords.txt</str>
  1031 + </lst>
  1032 + <lst name="slave">
  1033 + <str name="masterUrl">http://localhost:8983/solr/replication</str>
  1034 + <str name="pollInterval">00:00:60</str>
  1035 + </lst>
  1036 + </requestHandler>
  1037 + -->
  1038 +
  1039 + <!-- Search Components
  1040 +
  1041 + Search components are registered to SolrCore and used by
  1042 + instances of SearchHandler (which can access them by name)
  1043 +
  1044 + By default, the following components are available:
  1045 +
  1046 + <searchComponent name="query" class="solr.QueryComponent" />
  1047 + <searchComponent name="facet" class="solr.FacetComponent" />
  1048 + <searchComponent name="mlt" class="solr.MoreLikeThisComponent" />
  1049 + <searchComponent name="highlight" class="solr.HighlightComponent" />
  1050 + <searchComponent name="stats" class="solr.StatsComponent" />
  1051 + <searchComponent name="debug" class="solr.DebugComponent" />
  1052 +
  1053 + Default configuration in a requestHandler would look like:
  1054 +
  1055 + <arr name="components">
  1056 + <str>query</str>
  1057 + <str>facet</str>
  1058 + <str>mlt</str>
  1059 + <str>highlight</str>
  1060 + <str>stats</str>
  1061 + <str>debug</str>
  1062 + </arr>
  1063 +
  1064 + If you register a searchComponent to one of the standard names,
  1065 + that will be used instead of the default.
  1066 +
  1067 + To insert components before or after the 'standard' components, use:
  1068 +
  1069 + <arr name="first-components">
  1070 + <str>myFirstComponentName</str>
  1071 + </arr>
  1072 +
  1073 + <arr name="last-components">
  1074 + <str>myLastComponentName</str>
  1075 + </arr>
  1076 +
  1077 + NOTE: The component registered with the name "debug" will
  1078 + always be executed after the "last-components"
  1079 +
  1080 + -->
  1081 +
  1082 + <!-- Spell Check
  1083 +
  1084 + The spell check component can return a list of alternative spelling
  1085 + suggestions.
  1086 +
  1087 + http://wiki.apache.org/solr/SpellCheckComponent
  1088 + -->
  1089 + <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
  1090 +
  1091 + <str name="queryAnalyzerFieldType">textSpell</str>
  1092 +
  1093 + <!-- Multiple "Spell Checkers" can be declared and used by this
  1094 + component
  1095 + -->
  1096 +
  1097 + <!-- a spellchecker built from a field of the main index, and
  1098 + written to disk
  1099 + -->
  1100 + <lst name="spellchecker">
  1101 + <str name="name">default</str>
  1102 + <str name="field">name</str>
  1103 + <str name="spellcheckIndexDir">spellchecker</str>
  1104 + <!-- uncomment this to require terms to occur in 1% of the documents in order to be included in the dictionary
  1105 + <float name="thresholdTokenFrequency">.01</float>
  1106 + -->
  1107 + </lst>
  1108 +
  1109 + <!-- a spellchecker that uses a different distance measure -->
  1110 + <!--
  1111 + <lst name="spellchecker">
  1112 + <str name="name">jarowinkler</str>
  1113 + <str name="field">spell</str>
  1114 + <str name="distanceMeasure">
  1115 + org.apache.lucene.search.spell.JaroWinklerDistance
  1116 + </str>
  1117 + <str name="spellcheckIndexDir">spellcheckerJaro</str>
  1118 + </lst>
  1119 + -->
  1120 +
  1121 + <!-- a spellchecker that use an alternate comparator
  1122 +
  1123 + comparatorClass be one of:
  1124 + 1. score (default)
  1125 + 2. freq (Frequency first, then score)
  1126 + 3. A fully qualified class name
  1127 + -->
  1128 + <!--
  1129 + <lst name="spellchecker">
  1130 + <str name="name">freq</str>
  1131 + <str name="field">lowerfilt</str>
  1132 + <str name="spellcheckIndexDir">spellcheckerFreq</str>
  1133 + <str name="comparatorClass">freq</str>
  1134 + <str name="buildOnCommit">true</str>
  1135 + -->
  1136 +
  1137 + <!-- A spellchecker that reads the list of words from a file -->
  1138 + <!--
  1139 + <lst name="spellchecker">
  1140 + <str name="classname">solr.FileBasedSpellChecker</str>
  1141 + <str name="name">file</str>
  1142 + <str name="sourceLocation">spellings.txt</str>
  1143 + <str name="characterEncoding">UTF-8</str>
  1144 + <str name="spellcheckIndexDir">spellcheckerFile</str>
  1145 + </lst>
  1146 + -->
  1147 + </searchComponent>
  1148 +
  1149 + <!-- A request handler for demonstrating the spellcheck component.
  1150 +
  1151 + NOTE: This is purely as an example. The whole purpose of the
  1152 + SpellCheckComponent is to hook it into the request handler that
  1153 + handles your normal user queries so that a separate request is
  1154 + not needed to get suggestions.
  1155 +
  1156 + IN OTHER WORDS, THERE IS REALLY GOOD CHANCE THE SETUP BELOW IS
  1157 + NOT WHAT YOU WANT FOR YOUR PRODUCTION SYSTEM!
  1158 +
  1159 + See http://wiki.apache.org/solr/SpellCheckComponent for details
  1160 + on the request parameters.
  1161 + -->
  1162 + <requestHandler name="/spell" class="solr.SearchHandler" startup="lazy">
  1163 + <lst name="defaults">
  1164 + <str name="spellcheck.onlyMorePopular">false</str>
  1165 + <str name="spellcheck.extendedResults">false</str>
  1166 + <str name="spellcheck.count">1</str>
  1167 + </lst>
  1168 + <arr name="last-components">
  1169 + <str>spellcheck</str>
  1170 + </arr>
  1171 + </requestHandler>
  1172 +
  1173 + <!-- Term Vector Component
  1174 +
  1175 + http://wiki.apache.org/solr/TermVectorComponent
  1176 + -->
  1177 + <searchComponent name="tvComponent" class="solr.TermVectorComponent"/>
  1178 +
  1179 + <!-- A request handler for demonstrating the term vector component
  1180 +
  1181 + This is purely as an example.
  1182 +
  1183 + In reality you will likely want to add the component to your
  1184 + already specified request handlers.
  1185 + -->
  1186 + <requestHandler name="tvrh" class="solr.SearchHandler" startup="lazy">
  1187 + <lst name="defaults">
  1188 + <bool name="tv">true</bool>
  1189 + </lst>
  1190 + <arr name="last-components">
  1191 + <str>tvComponent</str>
  1192 + </arr>
  1193 + </requestHandler>
  1194 +
  1195 + <!-- Clustering Component
  1196 +
  1197 + http://wiki.apache.org/solr/ClusteringComponent
  1198 +
  1199 + This relies on third party jars which are notincluded in the
  1200 + release. To use this component (and the "/clustering" handler)
  1201 + Those jars will need to be downloaded, and you'll need to set
  1202 + the solr.cluster.enabled system property when running solr...
  1203 +
  1204 + java -Dsolr.clustering.enabled=true -jar start.jar
  1205 + -->
  1206 + <searchComponent name="clustering"
  1207 + enable="${solr.clustering.enabled:false}"
  1208 + class="solr.clustering.ClusteringComponent" >
  1209 + <!-- Declare an engine -->
  1210 + <lst name="engine">
  1211 + <!-- The name, only one can be named "default" -->
  1212 + <str name="name">default</str>
  1213 +
  1214 + <!-- Class name of Carrot2 clustering algorithm.
  1215 +
  1216 + Currently available algorithms are:
  1217 +
  1218 + * org.carrot2.clustering.lingo.LingoClusteringAlgorithm
  1219 + * org.carrot2.clustering.stc.STCClusteringAlgorithm
  1220 + * org.carrot2.clustering.kmeans.BisectingKMeansClusteringAlgorithm
  1221 +
  1222 + See http://project.carrot2.org/algorithms.html for the
  1223 + algorithm's characteristics.
  1224 + -->
  1225 + <str name="carrot.algorithm">org.carrot2.clustering.lingo.LingoClusteringAlgorithm</str>
  1226 +
  1227 + <!-- Overriding values for Carrot2 default algorithm attributes.
  1228 +
  1229 + For a description of all available attributes, see:
  1230 + http://download.carrot2.org/stable/manual/#chapter.components.
  1231 + Use attribute key as name attribute of str elements
  1232 + below. These can be further overridden for individual
  1233 + requests by specifying attribute key as request parameter
  1234 + name and attribute value as parameter value.
  1235 + -->
  1236 + <str name="LingoClusteringAlgorithm.desiredClusterCountBase">20</str>
  1237 +
  1238 + <!-- Location of Carrot2 lexical resources.
  1239 +
  1240 + A directory from which to load Carrot2-specific stop words
  1241 + and stop labels. Absolute or relative to Solr config directory.
  1242 + If a specific resource (e.g. stopwords.en) is present in the
  1243 + specified dir, it will completely override the corresponding
  1244 + default one that ships with Carrot2.
  1245 +
  1246 + For an overview of Carrot2 lexical resources, see:
  1247 + http://download.carrot2.org/head/manual/#chapter.lexical-resources
  1248 + -->
  1249 + <str name="carrot.lexicalResourcesDir">clustering/carrot2</str>
  1250 +
  1251 + <!-- The language to assume for the documents.
  1252 +
  1253 + For a list of allowed values, see:
  1254 + http://download.carrot2.org/stable/manual/#section.attribute.lingo.MultilingualClustering.defaultLanguage
  1255 + -->
  1256 + <str name="MultilingualClustering.defaultLanguage">ENGLISH</str>
  1257 + </lst>
  1258 + <lst name="engine">
  1259 + <str name="name">stc</str>
  1260 + <str name="carrot.algorithm">org.carrot2.clustering.stc.STCClusteringAlgorithm</str>
  1261 + </lst>
  1262 + </searchComponent>
  1263 +
  1264 + <!-- A request handler for demonstrating the clustering component
  1265 +
  1266 + This is purely as an example.
  1267 +
  1268 + In reality you will likely want to add the component to your
  1269 + already specified request handlers.
  1270 + -->
  1271 + <requestHandler name="/clustering"
  1272 + startup="lazy"
  1273 + enable="${solr.clustering.enabled:false}"
  1274 + class="solr.SearchHandler">
  1275 + <lst name="defaults">
  1276 + <bool name="clustering">true</bool>
  1277 + <str name="clustering.engine">default</str>
  1278 + <bool name="clustering.results">true</bool>
  1279 + <!-- The title field -->
  1280 + <str name="carrot.title">name</str>
  1281 + <str name="carrot.url">id</str>
  1282 + <!-- The field to cluster on -->
  1283 + <str name="carrot.snippet">features</str>
  1284 + <!-- produce summaries -->
  1285 + <bool name="carrot.produceSummary">true</bool>
  1286 + <!-- the maximum number of labels per cluster -->
  1287 + <!--<int name="carrot.numDescriptions">5</int>-->
  1288 + <!-- produce sub clusters -->
  1289 + <bool name="carrot.outputSubClusters">false</bool>
  1290 +
  1291 + <str name="defType">edismax</str>
  1292 + <str name="qf">
  1293 + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
  1294 + </str>
  1295 + <str name="q.alt">*:*</str>
  1296 + <str name="rows">10</str>
  1297 + <str name="fl">*,score</str>
  1298 + </lst>
  1299 + <arr name="last-components">
  1300 + <str>clustering</str>
  1301 + </arr>
  1302 + </requestHandler>
  1303 +
  1304 + <!-- Terms Component
  1305 +
  1306 + http://wiki.apache.org/solr/TermsComponent
  1307 +
  1308 + A component to return terms and document frequency of those
  1309 + terms
  1310 + -->
  1311 + <searchComponent name="terms" class="solr.TermsComponent"/>
  1312 +
  1313 + <!-- A request handler for demonstrating the terms component -->
  1314 + <requestHandler name="/terms" class="solr.SearchHandler" startup="lazy">
  1315 + <lst name="defaults">
  1316 + <bool name="terms">true</bool>
  1317 + </lst>
  1318 + <arr name="components">
  1319 + <str>terms</str>
  1320 + </arr>
  1321 + </requestHandler>
  1322 +
  1323 +
  1324 + <!-- Query Elevation Component
  1325 +
  1326 + http://wiki.apache.org/solr/QueryElevationComponent
  1327 +
  1328 + a search component that enables you to configure the top
  1329 + results for a given query regardless of the normal lucene
  1330 + scoring.
  1331 + -->
  1332 + <searchComponent name="elevator" class="solr.QueryElevationComponent" >
  1333 + <!-- pick a fieldType to analyze queries -->
  1334 + <str name="queryFieldType">string</str>
  1335 + <str name="config-file">elevate.xml</str>
  1336 + </searchComponent>
  1337 +
  1338 + <!-- A request handler for demonstrating the elevator component -->
  1339 + <requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">
  1340 + <lst name="defaults">
  1341 + <str name="echoParams">explicit</str>
  1342 + </lst>
  1343 + <arr name="last-components">
  1344 + <str>elevator</str>
  1345 + </arr>
  1346 + </requestHandler>
  1347 +
  1348 + <!-- Highlighting Component
  1349 +
  1350 + http://wiki.apache.org/solr/HighlightingParameters
  1351 + -->
  1352 + <searchComponent class="solr.HighlightComponent" name="highlight">
  1353 + <highlighting>
  1354 + <!-- Configure the standard fragmenter -->
  1355 + <!-- This could most likely be commented out in the "default" case -->
  1356 + <fragmenter name="gap"
  1357 + default="true"
  1358 + class="solr.highlight.GapFragmenter">
  1359 + <lst name="defaults">
  1360 + <int name="hl.fragsize">100</int>
  1361 + </lst>
  1362 + </fragmenter>
  1363 +
  1364 + <!-- A regular-expression-based fragmenter
  1365 + (for sentence extraction)
  1366 + -->
  1367 + <fragmenter name="regex"
  1368 + class="solr.highlight.RegexFragmenter">
  1369 + <lst name="defaults">
  1370 + <!-- slightly smaller fragsizes work better because of slop -->
  1371 + <int name="hl.fragsize">70</int>
  1372 + <!-- allow 50% slop on fragment sizes -->
  1373 + <float name="hl.regex.slop">0.5</float>
  1374 + <!-- a basic sentence pattern -->
  1375 + <str name="hl.regex.pattern">[-\w ,/\n\&quot;&apos;]{20,200}</str>
  1376 + </lst>
  1377 + </fragmenter>
  1378 +
  1379 + <!-- Configure the standard formatter -->
  1380 + <formatter name="html"
  1381 + default="true"
  1382 + class="solr.highlight.HtmlFormatter">
  1383 + <lst name="defaults">
  1384 + <str name="hl.simple.pre"><![CDATA[<em>]]></str>
  1385 + <str name="hl.simple.post"><![CDATA[</em>]]></str>
  1386 + </lst>
  1387 + </formatter>
  1388 +
  1389 + <!-- Configure the standard encoder -->
  1390 + <encoder name="html"
  1391 + class="solr.highlight.HtmlEncoder" />
  1392 +
  1393 + <!-- Configure the standard fragListBuilder -->
  1394 + <fragListBuilder name="simple"
  1395 + default="true"
  1396 + class="solr.highlight.SimpleFragListBuilder"/>
  1397 +
  1398 + <!-- Configure the single fragListBuilder -->
  1399 + <fragListBuilder name="single"
  1400 + class="solr.highlight.SingleFragListBuilder"/>
  1401 +
  1402 + <!-- default tag FragmentsBuilder -->
  1403 + <fragmentsBuilder name="default"
  1404 + default="true"
  1405 + class="solr.highlight.ScoreOrderFragmentsBuilder">
  1406 + <!--
  1407 + <lst name="defaults">
  1408 + <str name="hl.multiValuedSeparatorChar">/</str>
  1409 + </lst>
  1410 + -->
  1411 + </fragmentsBuilder>
  1412 +
  1413 + <!-- multi-colored tag FragmentsBuilder -->
  1414 + <fragmentsBuilder name="colored"
  1415 + class="solr.highlight.ScoreOrderFragmentsBuilder">
  1416 + <lst name="defaults">
  1417 + <str name="hl.tag.pre"><![CDATA[
  1418 + <b style="background:yellow">,<b style="background:lawgreen">,
  1419 + <b style="background:aquamarine">,<b style="background:magenta">,
  1420 + <b style="background:palegreen">,<b style="background:coral">,
  1421 + <b style="background:wheat">,<b style="background:khaki">,
  1422 + <b style="background:lime">,<b style="background:deepskyblue">]]></str>
  1423 + <str name="hl.tag.post"><![CDATA[</b>]]></str>
  1424 + </lst>
  1425 + </fragmentsBuilder>
  1426 +
  1427 + <boundaryScanner name="default"
  1428 + default="true"
  1429 + class="solr.highlight.SimpleBoundaryScanner">
  1430 + <lst name="defaults">
  1431 + <str name="hl.bs.maxScan">10</str>
  1432 + <str name="hl.bs.chars">.,!? &#9;&#10;&#13;</str>
  1433 + </lst>
  1434 + </boundaryScanner>
  1435 +
  1436 + <boundaryScanner name="breakIterator"
  1437 + class="solr.highlight.BreakIteratorBoundaryScanner">
  1438 + <lst name="defaults">
  1439 + <!-- type should be one of CHARACTER, WORD(default), LINE and SENTENCE -->
  1440 + <str name="hl.bs.type">WORD</str>
  1441 + <!-- language and country are used when constructing Locale object. -->
  1442 + <!-- And the Locale object will be used when getting instance of BreakIterator -->
  1443 + <str name="hl.bs.language">en</str>
  1444 + <str name="hl.bs.country">US</str>
  1445 + </lst>
  1446 + </boundaryScanner>
  1447 + </highlighting>
  1448 + </searchComponent>
  1449 +
  1450 + <!-- Update Processors
  1451 +
  1452 + Chains of Update Processor Factories for dealing with Update
  1453 + Requests can be declared, and then used by name in Update
  1454 + Request Processors
  1455 +
  1456 + http://wiki.apache.org/solr/UpdateRequestProcessor
  1457 +
  1458 + -->
  1459 + <!-- Deduplication
  1460 +
  1461 + An example dedup update processor that creates the "id" field
  1462 + on the fly based on the hash code of some other fields. This
  1463 + example has overwriteDupes set to false since we are using the
  1464 + id field as the signatureField and Solr will maintain
  1465 + uniqueness based on that anyway.
  1466 +
  1467 + -->
  1468 + <!--
  1469 + <updateRequestProcessorChain name="dedupe">
  1470 + <processor class="solr.processor.SignatureUpdateProcessorFactory">
  1471 + <bool name="enabled">true</bool>
  1472 + <str name="signatureField">id</str>
  1473 + <bool name="overwriteDupes">false</bool>
  1474 + <str name="fields">name,features,cat</str>
  1475 + <str name="signatureClass">solr.processor.Lookup3Signature</str>
  1476 + </processor>
  1477 + <processor class="solr.LogUpdateProcessorFactory" />
  1478 + <processor class="solr.RunUpdateProcessorFactory" />
  1479 + </updateRequestProcessorChain>
  1480 + -->
  1481 +
  1482 + <!--
  1483 + This example update chain identifies the language of the incoming
  1484 + documents using the langid contrib. The detected language is
  1485 + written to field language_s. No field name mapping is done.
  1486 + The fields used for detection are text, title, subject and description,
  1487 + making this example suitable for detecting languages form full-text
  1488 + rich documents injected via ExtractingRequestHandler.
  1489 + See more about langId at http://wiki.apache.org/solr/LanguageDetection
  1490 + -->
  1491 + <!--
  1492 + <updateRequestProcessorChain name="langid">
  1493 + <processor class="org.apache.solr.update.processor.TikaLanguageIdentifierUpdateProcessorFactory">
  1494 + <str name="langid.fl">text,title,subject,description</str>
  1495 + <str name="langid.langField">language_s</str>
  1496 + <str name="langid.fallback">en</str>
  1497 + </processor>
  1498 + <processor class="solr.LogUpdateProcessorFactory" />
  1499 + <processor class="solr.RunUpdateProcessorFactory" />
  1500 + </updateRequestProcessorChain>
  1501 + -->
  1502 +
  1503 + <!-- Response Writers
  1504 +
  1505 + http://wiki.apache.org/solr/QueryResponseWriter
  1506 +
  1507 + Request responses will be written using the writer specified by
  1508 + the 'wt' request parameter matching the name of a registered
  1509 + writer.
  1510 +
  1511 + The "default" writer is the default and will be used if 'wt' is
  1512 + not specified in the request.
  1513 + -->
  1514 + <!-- The following response writers are implicitly configured unless
  1515 + overridden...
  1516 + -->
  1517 + <!--
  1518 + <queryResponseWriter name="xml"
  1519 + default="true"
  1520 + class="solr.XMLResponseWriter" />
  1521 + <queryResponseWriter name="json" class="solr.JSONResponseWriter"/>
  1522 + <queryResponseWriter name="python" class="solr.PythonResponseWriter"/>
  1523 + <queryResponseWriter name="ruby" class="solr.RubyResponseWriter"/>
  1524 + <queryResponseWriter name="php" class="solr.PHPResponseWriter"/>
  1525 + <queryResponseWriter name="phps" class="solr.PHPSerializedResponseWriter"/>
  1526 + <queryResponseWriter name="csv" class="solr.CSVResponseWriter"/>
  1527 + -->
  1528 +
  1529 + <queryResponseWriter name="json" class="solr.JSONResponseWriter">
  1530 + <!-- For the purposes of the tutorial, JSON responses are written as
  1531 + plain text so that they are easy to read in *any* browser.
  1532 + If you expect a MIME type of "application/json" just remove this override.
  1533 + -->
  1534 + <str name="content-type">text/plain; charset=UTF-8</str>
  1535 + </queryResponseWriter>
  1536 +
  1537 + <!--
  1538 + Custom response writers can be declared as needed...
  1539 + -->
  1540 + <!-- The solr.velocity.enabled flag is used by Solr's test cases so that this response writer is not
  1541 + loaded (causing an error if contrib/velocity has not been built fully) -->
  1542 + <!--
  1543 + <queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" enable="${solr.velocity.enabled:true}"/>
  1544 + -->
  1545 +
  1546 +
  1547 + <!-- XSLT response writer transforms the XML output by any xslt file found
  1548 + in Solr's conf/xslt directory. Changes to xslt files are checked for
  1549 + every xsltCacheLifetimeSeconds.
  1550 + -->
  1551 + <queryResponseWriter name="xslt" class="solr.XSLTResponseWriter">
  1552 + <int name="xsltCacheLifetimeSeconds">5</int>
  1553 + </queryResponseWriter>
  1554 +
  1555 + <!-- Query Parsers
  1556 +
  1557 + http://wiki.apache.org/solr/SolrQuerySyntax
  1558 +
  1559 + Multiple QParserPlugins can be registered by name, and then
  1560 + used in either the "defType" param for the QueryComponent (used
  1561 + by SearchHandler) or in LocalParams
  1562 + -->
  1563 + <!-- example of registering a query parser -->
  1564 + <!--
  1565 + <queryParser name="myparser" class="com.mycompany.MyQParserPlugin"/>
  1566 + -->
  1567 +
  1568 + <!-- Function Parsers
  1569 +
  1570 + http://wiki.apache.org/solr/FunctionQuery
  1571 +
  1572 + Multiple ValueSourceParsers can be registered by name, and then
  1573 + used as function names when using the "func" QParser.
  1574 + -->
  1575 + <!-- example of registering a custom function parser -->
  1576 + <!--
  1577 + <valueSourceParser name="myfunc"
  1578 + class="com.mycompany.MyValueSourceParser" />
  1579 + -->
  1580 +
  1581 + <!-- Legacy config for the admin interface -->
  1582 + <admin>
  1583 + <defaultQuery>*:*</defaultQuery>
  1584 +
  1585 + <!-- configure a healthcheck file for servers behind a
  1586 + loadbalancer
  1587 + -->
  1588 + <!--
  1589 + <healthcheck type="file">server-enabled</healthcheck>
  1590 + -->
  1591 + </admin>
  1592 +
  1593 +</config>
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/spellings.en.txt 0 → 100644
@@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
  1 +pizza
  2 +history
0 \ No newline at end of file 3 \ No newline at end of file
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/spellings.txt
@@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
1 -pizza  
2 -history  
3 \ No newline at end of file 0 \ No newline at end of file
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/stopwords.en.txt 0 → 100644
@@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
  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 +#-----------------------------------------------------------------------
  17 +# a couple of test stopwords to test that the words are really being
  18 +# configured from this file:
  19 +stopworda
  20 +stopwordb
  21 +
  22 +#Standard english stop words taken from Lucene's StopAnalyzer
  23 +a
  24 +an
  25 +and
  26 +are
  27 +as
  28 +at
  29 +be
  30 +but
  31 +by
  32 +for
  33 +if
  34 +in
  35 +into
  36 +is
  37 +it
  38 +no
  39 +not
  40 +of
  41 +on
  42 +or
  43 +s
  44 +such
  45 +t
  46 +that
  47 +the
  48 +their
  49 +then
  50 +there
  51 +these
  52 +they
  53 +this
  54 +to
  55 +was
  56 +will
  57 +with
  58 +
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/stopwords.pt.txt 0 → 100644
@@ -0,0 +1,128 @@ @@ -0,0 +1,128 @@
  1 +a
  2 +ainda
  3 +alem
  4 +ambas
  5 +ambos
  6 +antes
  7 +ao
  8 +aonde
  9 +aos
  10 +apos
  11 +aquele
  12 +aqueles
  13 +as
  14 +assim
  15 +com
  16 +como
  17 +contra
  18 +contudo
  19 +cuja
  20 +cujas
  21 +cujo
  22 +cujos
  23 +da
  24 +das
  25 +de
  26 +dela
  27 +dele
  28 +deles
  29 +demais
  30 +depois
  31 +desde
  32 +desta
  33 +deste
  34 +dispoe
  35 +dispoem
  36 +diversa
  37 +diversas
  38 +diversos
  39 +do
  40 +dos
  41 +durante
  42 +e
  43 +ela
  44 +elas
  45 +ele
  46 +eles
  47 +em
  48 +entao
  49 +entre
  50 +essa
  51 +essas
  52 +esse
  53 +esses
  54 +esta
  55 +estas
  56 +este
  57 +estes
  58 +ha
  59 +isso
  60 +isto
  61 +logo
  62 +mais
  63 +mas
  64 +mediante
  65 +menos
  66 +mesma
  67 +mesmas
  68 +mesmo
  69 +mesmos
  70 +na
  71 +nas
  72 +nao
  73 +nas
  74 +nem
  75 +nesse
  76 +neste
  77 +nos
  78 +o
  79 +os
  80 +ou
  81 +outra
  82 +outras
  83 +outro
  84 +outros
  85 +pelas
  86 +pelas
  87 +pelo
  88 +pelos
  89 +perante
  90 +pois
  91 +por
  92 +porque
  93 +portanto
  94 +proprio
  95 +propios
  96 +quais
  97 +qual
  98 +qualquer
  99 +quando
  100 +quanto
  101 +que
  102 +quem
  103 +quer
  104 +se
  105 +seja
  106 +sem
  107 +sendo
  108 +seu
  109 +seus
  110 +sob
  111 +sobre
  112 +sua
  113 +suas
  114 +tal
  115 +tambem
  116 +teu
  117 +teus
  118 +toda
  119 +todas
  120 +todo
  121 +todos
  122 +tua
  123 +tuas
  124 +tudo
  125 +um
  126 +uma
  127 +umas
  128 +uns
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/stopwords.txt
@@ -1,58 +0,0 @@ @@ -1,58 +0,0 @@
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 -#-----------------------------------------------------------------------  
17 -# a couple of test stopwords to test that the words are really being  
18 -# configured from this file:  
19 -stopworda  
20 -stopwordb  
21 -  
22 -#Standard english stop words taken from Lucene's StopAnalyzer  
23 -a  
24 -an  
25 -and  
26 -are  
27 -as  
28 -at  
29 -be  
30 -but  
31 -by  
32 -for  
33 -if  
34 -in  
35 -into  
36 -is  
37 -it  
38 -no  
39 -not  
40 -of  
41 -on  
42 -or  
43 -s  
44 -such  
45 -t  
46 -that  
47 -the  
48 -their  
49 -then  
50 -there  
51 -these  
52 -they  
53 -this  
54 -to  
55 -was  
56 -will  
57 -with  
58 -  
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/synonyms.en.txt 0 → 100644
@@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
  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 +#-----------------------------------------------------------------------
  14 +#some test synonym mappings unlikely to appear in real input text
  15 +aaa => aaaa
  16 +bbb => bbbb1 bbbb2
  17 +ccc => cccc1,cccc2
  18 +a\=>a => b\=>b
  19 +a\,a => b\,b
  20 +fooaaa,baraaa,bazaaa
  21 +
  22 +# Some synonym groups specific to this example
  23 +GB,gib,gigabyte,gigabytes
  24 +MB,mib,megabyte,megabytes
  25 +Television, Televisions, TV, TVs
  26 +#notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming
  27 +#after us won't split it into two words.
  28 +
  29 +# Synonym mappings can be used for spelling correction too
  30 +pixima => pixma
  31 +
vendor/plugins/acts_as_solr_reloaded/solr/solr/conf/synonyms.txt
@@ -1,31 +0,0 @@ @@ -1,31 +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 -#-----------------------------------------------------------------------  
14 -#some test synonym mappings unlikely to appear in real input text  
15 -aaa => aaaa  
16 -bbb => bbbb1 bbbb2  
17 -ccc => cccc1,cccc2  
18 -a\=>a => b\=>b  
19 -a\,a => b\,b  
20 -fooaaa,baraaa,bazaaa  
21 -  
22 -# Some synonym groups specific to this example  
23 -GB,gib,gigabyte,gigabytes  
24 -MB,mib,megabyte,megabytes  
25 -Television, Televisions, TV, TVs  
26 -#notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming  
27 -#after us won't split it into two words.  
28 -  
29 -# Synonym mappings can be used for spelling correction too  
30 -pixima => pixma  
31 -  
vendor/plugins/acts_as_solr_reloaded/test/functional/acts_as_solr_test.rb
@@ -438,16 +438,12 @@ class ActsAsSolrTest &lt; Test::Unit::TestCase @@ -438,16 +438,12 @@ class ActsAsSolrTest &lt; Test::Unit::TestCase
438 end 438 end
439 439
440 def test_search_given_a_radius 440 def test_search_given_a_radius
441 - records = Advertise.search "bike", :around => {:latitude => '-39.36',  
442 - :longitude => '77.4027',  
443 - :radius => 1} 441 + records = Advertise.search "bike", :latitude => '-39.36', :longitude => '77.4027', :radius => 1
444 assert_equal 0, records.total 442 assert_equal 0, records.total
445 end 443 end
446 444
447 def test_records_are_found_in_a_radius 445 def test_records_are_found_in_a_radius
448 - records = Advertise.search "bike", :around => {:latitude => '39.36',  
449 - :longitude => '-77.4027',  
450 - :radius => 1} 446 + records = Advertise.search "bike", :latitude => '39.36', :longitude => '-77.4027', :radius => 1
451 assert_equal 1, records.total 447 assert_equal 1, records.total
452 end 448 end
453 449
vendor/plugins/acts_as_solr_reloaded/test/unit/parser_methods_shoulda.rb
@@ -263,36 +263,28 @@ class ParserMethodsTest &lt; Test::Unit::TestCase @@ -263,36 +263,28 @@ class ParserMethodsTest &lt; Test::Unit::TestCase
263 ActsAsSolr::Post.expects(:execute).with {|request, core| 263 ActsAsSolr::Post.expects(:execute).with {|request, core|
264 request.to_hash[:qt] == ('geo') 264 request.to_hash[:qt] == ('geo')
265 } 265 }
266 - @parser.parse_query "foo" , :around => {:latitude => '-39.36',  
267 - :longitude => '77.4027',  
268 - :radius => 1} 266 + @parser.parse_query "foo" , :latitude => '-39.36', :longitude => '77.4027', :radius => 1
269 end 267 end
270 268
271 should "set the radius" do 269 should "set the radius" do
272 ActsAsSolr::Post.expects(:execute).with {|request, core| 270 ActsAsSolr::Post.expects(:execute).with {|request, core|
273 request.to_hash[:radius] == 12 271 request.to_hash[:radius] == 12
274 } 272 }
275 - @parser.parse_query "foo" , :around => {:latitude => '-39.36',  
276 - :longitude => '77.4027',  
277 - :radius => 12} 273 + @parser.parse_query "foo" , :latitude => '-39.36', :longitude => '77.4027', :radius => 12
278 end 274 end
279 275
280 should "set the latitude" do 276 should "set the latitude" do
281 ActsAsSolr::Post.expects(:execute).with {|request, core| 277 ActsAsSolr::Post.expects(:execute).with {|request, core|
282 request.to_hash[:lat] == '-39.36' 278 request.to_hash[:lat] == '-39.36'
283 } 279 }
284 - @parser.parse_query "foo" , :around => {:latitude => '-39.36',  
285 - :longitude => '77.4027',  
286 - :radius => 12} 280 + @parser.parse_query "foo" , :latitude => '-39.36', :longitude => '77.4027', :radius => 12
287 end 281 end
288 282
289 should "set the longitude" do 283 should "set the longitude" do
290 ActsAsSolr::Post.expects(:execute).with {|request, core| 284 ActsAsSolr::Post.expects(:execute).with {|request, core|
291 request.to_hash[:long] == '77.4027' 285 request.to_hash[:long] == '77.4027'
292 } 286 }
293 - @parser.parse_query "foo" , :around => {:latitude => '-39.36',  
294 - :longitude => '77.4027',  
295 - :radius => 12} 287 + @parser.parse_query "foo" , :latitude => '-39.36', :longitude => '77.4027', :radius => 12
296 end 288 end
297 end 289 end
298 290