Module ActsAsIndexed::ClassMethods
In: lib/acts_as_indexed/class_methods.rb

Methods

Included Modules

ActsAsIndexed::InstanceMethods

Public Instance methods

Declares a class as searchable.

options:

fields:Names of fields to include in the index. Symbols pointing to instance methods of your model may also be given here.
index_file_depth:Tuning value for the index partitioning. Larger values result in quicker searches, but slower indexing. Default is 3.
min_word_size:Sets the minimum length for a word in a query. Words shorter than this value are ignored in searches unless preceded by the ’+’ operator. Default is 3.
index_file:Sets the location for the index. By default this is RAILS_ROOT/tmp/index. Specify as an array. The default, for example, would be set as [Rails.root,’tmp’,’index].

Builds an index from scratch for the current model class. Does not run if the index already exists.

Adds the passed record to the index. Index is built if it does not already exist. Clears the query cache.

Removes the passed record from the index. Clears the query cache.

Updates the index.

  1. Removes the previous version of the record from the index
  2. Adds the new version to the index.

Finds instances matching the terms passed in query. Terms are ANDed by default. Returns an array of model instances or, if ids_only is true, an array of integer IDs.

Keeps a cache of matched IDs for the current session to speed up multiple identical searches.

find_options

Same as ActiveRecord#find options hash. An :order key will override the relevance ranking

options

ids_only:Method returns an array of integer IDs when set to true.
no_query_cache:Turns off the query cache when set to true. Useful for testing.

[Validate]