Sha256: 39c22ddca712855556167e286bdb269e88d473c260e282a7186deaa5bfea0df3

Contents?: true

Size: 1.79 KB

Versions: 37

Compression:

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

Version data entries

37 entries across 37 versions & 8 rubygems

Version Path
freelancing-god-thinking-sphinx-1.1.23 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-1.1.24 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-1.1.3 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-1.1.4 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-1.1.5 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-1.1.6 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-1.1.7 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-1.1.8 lib/thinking_sphinx/active_record/search.rb
freelancing-god-thinking-sphinx-1.1.9 lib/thinking_sphinx/active_record/search.rb
initforthe-thinking-sphinx-1.1.21 lib/thinking_sphinx/active_record/search.rb
lostboy-thinking-sphinx-1.1.5.1 lib/thinking_sphinx/active_record/search.rb
lostboy-thinking-sphinx-1.1.5.2 lib/thinking_sphinx/active_record/search.rb
lostboy-thinking-sphinx-1.1.5.3 lib/thinking_sphinx/active_record/search.rb
lostboy-thinking-sphinx-1.1.5.4 lib/thinking_sphinx/active_record/search.rb
lostboy-thinking-sphinx-1.1.5.5 lib/thinking_sphinx/active_record/search.rb
pixeltrix-thinking-sphinx-1.1.5 lib/thinking_sphinx/active_record/search.rb
sherpa99-thinking-sphinx-1.1.4 lib/thinking_sphinx/active_record/search.rb