Sha256: 4631187a16e2d5aa843265f4fef66cda5949606d54a8948359e1e861dfe8ae38

Contents?: true

Size: 600 Bytes

Versions: 6

Compression:

Stored size: 600 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
        RSolr.connect(ActiveFedora.solr_config)
      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

6 entries across 6 versions & 1 rubygems

Version Path
ddr-models-2.11.0 lib/ddr/index/connection.rb
ddr-models-2.10.2 lib/ddr/index/connection.rb
ddr-models-2.10.1 lib/ddr/index/connection.rb
ddr-models-2.10.0 lib/ddr/index/connection.rb
ddr-models-2.10.0.rc2 lib/ddr/index/connection.rb
ddr-models-2.10.0.rc1 lib/ddr/index/connection.rb