lib/solr/request/select.rb in solr-ruby-0.0.5 vs lib/solr/request/select.rb in solr-ruby-0.0.6
- old
+ new
@@ -13,17 +13,15 @@
require 'erb'
# "Abstract" base class, only useful with subclasses that add parameters
class Solr::Request::Select < Solr::Request::Base
- # TODO add a constant for the all-docs query, which currently is [* TO *]
- # (caveat, that is all docs that have a value in the default field)
- # When the Lucene JAR is upgraded in Solr, the all-docs query becomes simply *
attr_reader :query_type
- def initialize(qt=nil)
+ def initialize(qt=nil, params={})
@query_type = qt
+ @select_params = params
end
def response_format
:ruby
end
@@ -35,10 +33,10 @@
def content_type
'application/x-www-form-urlencoded; charset=utf-8'
end
def to_hash
- return {:qt => query_type, :wt => 'ruby'}
+ return {:qt => query_type, :wt => 'ruby'}.merge(@select_params)
end
def to_s
raw_params = self.to_hash