Sha256: e24ae83abc47de59a991fb65059a44899f69273a267cb2448328ca69e57382d9

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

module ThinkingSphinx
  module ActiveRecord
    # This module covers the specific model searches - but the syntax is
    # exactly the same as the core Search class - so use that as your refence
    # point.
    # 
    module Search
      def self.included(base)
        base.class_eval do
          class << self
            # Searches for results that match the parameters provided. Will only
            # return the ids for the matching objects. See
            # ThinkingSphinx::Search#search for syntax examples.
            #
            def search_for_ids(*args)
              options = args.extract_options!
              options[:class] = self
              args << options
              ThinkingSphinx::Search.search_for_ids(*args)
            end

            # Searches for results limited to a single model. See
            # ThinkingSphinx::Search#search for syntax examples.
            #
            def search(*args)
              options = args.extract_options!
              options[:class] = self
              args << options
              ThinkingSphinx::Search.search(*args)
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
freelancing-god-thinking-sphinx-0.9.5 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-0.9.6 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-0.9.7 lib/thinking_sphinx/active_record/search.rb