Sha256: 3cb6cccde6b35a100faff748aeeb04e2007c37c846ca8d80ad495ebed3363176

Contents?: true

Size: 738 Bytes

Versions: 1

Compression:

Stored size: 738 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

1 entries across 1 versions & 1 rubygems

Version Path
pg_search-2.1.4 lib/pg_search/document.rb