Module ThinkingSphinx::ActiveRecord::Scopes::ClassMethods
In: lib/thinking_sphinx/active_record/scopes.rb

Methods

Public Instance methods

Similar to ActiveRecord‘s default_scope method Thinking Sphinx supports a default_sphinx_scope. For example:

   default_sphinx_scope :some_sphinx_named_scope

The scope is automatically applied when the search method is called. It will only be applied if it is an existing sphinx_scope.

Returns the default_sphinx_scope or nil if none is set.

Returns true if the current Model has a default_sphinx_scope. Also checks if the default_sphinx_scope actually is a scope.

Similar to ActiveRecord‘s named_scope method Thinking Sphinx supports scopes. For example:

  sphinx_scope(:latest_first) {
      {:order => 'created_at DESC, @relevance DESC'}
    }

Usage:

  @articles =  Article.latest_first.search 'pancakes'

This returns an Array of all defined scopes. The default scope shows as :default.

[Validate]