Sha256: 78bc5c2ff634e955b0d20fd23e2f2250f0a31c143e911386b07af11f0faf2075

Contents?: true

Size: 729 Bytes

Versions: 2

Compression:

Stored size: 729 Bytes

Contents

require 'active_support/concern'
require 'georgia/indexer/adapter'

module Georgia
  module Indexer
    autoload :SolrAdapter, 'georgia/indexer/solr_adapter'
    autoload :TireAdapter, 'georgia/indexer/tire_adapter'

    def self.adapter
      @@adapter ||= adapter_lookup
    end

    # Delegates search to the adapter
    def self.search model, params
      adapter.search model, params
    end

    def self.register_extension indexer, klass
      return unless indexer == Georgia.indexer
      Adapter.load_extension(klass)
    end

    private

    def self.adapter_lookup
      @adapter_lookup ||= (case Georgia.indexer
        when :solr then SolrAdapter
        when :tire then TireAdapter
        end)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
georgia-0.7.8 lib/georgia/indexer.rb
georgia-0.7.7 lib/georgia/indexer.rb