Sha256: b5a63195a1ed83e9216fbc2d4ae2586717ebcb165673d32edd52b36799c54b94

Contents?: true

Size: 596 Bytes

Versions: 28

Compression:

Stored size: 596 Bytes

Contents

require "rsolr"
require "forwardable"

module Ddr::Index
  #
  # Wraps an RSolr connection
  #
  class Connection

    module Methods
      extend Forwardable

      delegate [:get, :post, :paginate] => :solr

      def solr
        Blacklight.default_index.connection
      end

      def select(params, extra={})
        Response.new post("select", params: params.merge(extra))
      end

      def page(*args)
        Response.new paginate(*args)
      end

      def count(params)
        select(params, rows: 0).num_found
      end
    end

    extend Methods
    include Methods

  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ddr-core-1.6.1 lib/ddr/index/connection.rb
ddr-core-1.6.0 lib/ddr/index/connection.rb
ddr-core-1.5.5 lib/ddr/index/connection.rb
ddr-core-1.5.4 lib/ddr/index/connection.rb
ddr-core-1.5.2 lib/ddr/index/connection.rb
ddr-core-1.5.3 lib/ddr/index/connection.rb
ddr-core-1.5.1 lib/ddr/index/connection.rb
ddr-core-1.4.4 lib/ddr/index/connection.rb