Sha256: c5c0179fb0c7ed353e1f5963324f8baa98cef23ff1744c93e8c3a0066531e352

Contents?: true

Size: 703 Bytes

Versions: 7

Compression:

Stored size: 703 Bytes

Contents

require 'logger'

module PgSearch
  class Document < ActiveRecord::Base
    include PgSearch

    self.table_name = 'pg_search_documents'
    belongs_to :searchable, :polymorphic => true

    # The logger might not have loaded yet.
    # https://github.com/Casecommons/pg_search/issues/26
    def self.logger
      super || Logger.new(STDERR)
    end

    pg_search_scope :search, lambda { |*args|
      options = if PgSearch.multisearch_options.respond_to?(:call)
                  PgSearch.multisearch_options.call(*args)
                else
                  {:query => args.first}.merge(PgSearch.multisearch_options)
                end

      {:against => :content}.merge(options)
    }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pg_search-2.1.3 lib/pg_search/document.rb
pg_search-2.1.2 lib/pg_search/document.rb
pg_search-2.1.1 lib/pg_search/document.rb
pg_search-2.1.0 lib/pg_search/document.rb
pg_search-2.0.1 lib/pg_search/document.rb
pg_search-2.0.0 lib/pg_search/document.rb
pg_search-1.0.6 lib/pg_search/document.rb