Sha256: 116466d6bbc5451f53d11aa5d85d9c4e1bbda9585c0c77273097e782b13b354b

Contents?: true

Size: 1.57 KB

Versions: 11

Compression:

Stored size: 1.57 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_count(*args)
              options = args.extract_options!
              options[:class] = self
              args << options
              ThinkingSphinx::Search.count(*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

11 entries across 11 versions & 5 rubygems

Version Path
DrMark-thinking-sphinx-0.9.9 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-0.9.10 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-0.9.11 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-0.9.12 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-0.9.13 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-1.1.0 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-1.1.1 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-1.1.2 lib/thinking_sphinx/active_record/search.rb
jaikoo-thinking-sphinx-0.9.10 lib/thinking_sphinx/active_record/search.rb
ryanb-thinking-sphinx-0.9.8 lib/thinking_sphinx/active_record/search.rb
ryanb-thinking_sphinx-0.9.8 lib/thinking_sphinx/active_record/search.rb