Sha256: 6fbf616052a675db0a64c09f28862edf519a0786379fc049d342f8ccf40dcadd

Contents?: true

Size: 642 Bytes

Versions: 7

Compression:

Stored size: 642 Bytes

Contents

# frozen_string_literal: true

require "pg_search/multisearch/rebuilder"

module PgSearch
  module Multisearch
    class << self
      def rebuild(model, clean_up = true)
        model.transaction do
          PgSearch::Document.where(searchable_type: model.base_class.name).delete_all if clean_up
          Rebuilder.new(model).rebuild
        end
      end
    end

    class ModelNotMultisearchable < StandardError
      def initialize(model_class)
        @model_class = model_class
      end

      def message
        "#{@model_class.name} is not multisearchable. See PgSearch::ClassMethods#multisearchable"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pg_search-2.3.2 lib/pg_search/multisearch.rb
pg_search-2.3.1 lib/pg_search/multisearch.rb
pg_search-2.3.0 lib/pg_search/multisearch.rb
pg_search-2.2.0 lib/pg_search/multisearch.rb
pg_search-2.1.7 lib/pg_search/multisearch.rb
pg_search-2.1.6 lib/pg_search/multisearch.rb
pg_search-2.1.5 lib/pg_search/multisearch.rb