Sha256: e78ca15128e95b3a7b1dfc588ee60fb452e39baff375a0b0effe6a3601fdeefc

Contents?: true

Size: 736 Bytes

Versions: 3

Compression:

Stored size: 736 Bytes

Contents

# frozen_string_literal: true

require 'logger'

module PgSearch
  class Document < ActiveRecord::Base
    include PgSearch::Model

    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

3 entries across 3 versions & 1 rubygems

Version Path
pg_search-2.3.2 lib/pg_search/document.rb
pg_search-2.3.1 lib/pg_search/document.rb
pg_search-2.3.0 lib/pg_search/document.rb