Sha256: e0b755b778ea02d970742f48e97863ef510667aa78615eaee49226a69d4955ef

Contents?: true

Size: 729 Bytes

Versions: 4

Compression:

Stored size: 729 Bytes

Contents

# frozen_string_literal: true

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

4 entries across 4 versions & 1 rubygems

Version Path
pg_search-2.2.0 lib/pg_search/document.rb
pg_search-2.1.7 lib/pg_search/document.rb
pg_search-2.1.6 lib/pg_search/document.rb
pg_search-2.1.5 lib/pg_search/document.rb