Sha256: bc7f7ff01f8619dbe2d877be3bcae36641a03812105ab5aa488b6c89c0183300

Contents?: true

Size: 1.26 KB

Versions: 9

Compression:

Stored size: 1.26 KB

Contents

module RSolr::Ext::Connection
  
  # TWO modes of arguments:
  #
  # <request-handler-path>, <solr-params-hash>
  # OR
  # <solr-params-hash>
  #
  # The default request-handler-path is /select
  # 
  # If a hash is used for solr params, all of the normal RSolr::Ext::Request
  # mappings are available (everything else gets passed to solr).
  # Returns a new RSolr::Ext::Response::Base object.
  def find *args
    # remove the handler arg - the first, if it is a string OR set default
    path = args.first.is_a?(String) ? args.shift : '/select'
    # remove the params - the first, if it is a Hash OR set default
    params = args.first.kind_of?(Hash) ? args.shift : {}
    # send path, map params and send the rest of the args along
    response = self.request path, RSolr::Ext::Request.map(params), *args
    RSolr::Ext::Response::Base.new(response)
  end
  
  # TWO modes of arguments:
  #
  # <request-handler-path>, <solr-params-hash>
  # OR
  # <solr-params-hash>
  #
  # The default request-handler-path is /admin/luke
  # The default params are numTerms=0
  #
  # Returns a new Mash object.
  def luke *args
    path = args.first.is_a?(String) ? args.shift : '/admin/luke'
    params = args.pop || {}
    params['numTerms'] ||= 0
    self.request(path, params).to_mash
  end
  
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
mwmitchell-rsolr-ext-0.9.6 lib/rsolr-ext/connection.rb
rsolr-ext-0.11.2 lib/rsolr-ext/connection.rb
rsolr-ext-0.11.1 lib/rsolr-ext/connection.rb
rsolr-ext-0.11.0 lib/rsolr-ext/connection.rb
rsolr-ext-0.10.1 lib/rsolr-ext/connection.rb
rsolr-ext-0.10.0 lib/rsolr-ext/connection.rb
rsolr-ext-0.9.6.5 lib/rsolr-ext/connection.rb
rsolr-ext-0.9.6.4 lib/rsolr-ext/connection.rb
rsolr-ext-0.9.6.3 lib/rsolr-ext/connection.rb