Sha256: d3e74f0809bddbcdfd0aa0f72549bd60f701aa9296e13a61df869eadecf63a27

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

# add this directory to the load path if it hasn't already been added

lambda { |base|
  $: << base unless $:.include?(base) || $:.include?(File.expand_path(base))
}.call(File.dirname(__FILE__))

unless defined?(Mash)
  require 'mash'
end

unless Hash.respond_to?(:to_mash)
  class Hash
    def to_mash
      Mash.new(self)
    end
  end
end

require 'rubygems'
require 'rsolr'

module RSolr
  
  module Ext
    
    VERSION = '0.7.1'
    
    autoload :Request, 'rsolr-ext/request.rb'
    autoload :Response, 'rsolr-ext/response.rb'
    autoload :Mapable, 'rsolr-ext/mapable.rb'
    autoload :Findable, 'rsolr-ext/findable.rb'
    
    # RSolr::Ext.map_params({})
    def self.map_params(r)
      RSolr::Ext::Request::Standard.new.map(r)
    end
    
    # RSolr::Ext.wrap_response({})
    def self.wrap_response(r)
      RSolr::Ext::Response::Standard.new(r)
    end
    
    # c = RSolr::Ext.connect
    # c.find(:q=>'*:*').docs.size
    def self.connect(*args)
      connection = RSolr.connect(*args)
      connection.extend RSolr::Ext::Findable
      connection
    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mwmitchell-rsolr-ext-0.7.1 lib/rsolr-ext.rb