Sha256: 68c71fd737d2978c77c54b18ecd5a7b4c541cec6d0b873fcac54e735e20173ac

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 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
            
            def search_for_id(*args)
              options = args.extract_options!
              options[:class] = self
              args << options
              ThinkingSphinx::Search.search_for_id(*args)
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
DrMark-thinking-sphinx-0.9.7 lib/thinking_sphinx/active_record/search.rb
DrMark-thinking-sphinx-0.9.8 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-0.9.8 lib/thinking_sphinx/active_record/search.rb
nixme-thinking-sphinx-0.9.7 lib/thinking_sphinx/active_record/search.rb