Class: Kiosk::Indexer::Adapter::ThinkingSphinxAdapter::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/kiosk/indexer/adapter/thinking_sphinx_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query, options = {}) ⇒ Search

Returns a new instance of Search.



70
71
72
73
74
# File 'lib/kiosk/indexer/adapter/thinking_sphinx_adapter.rb', line 70

def initialize(query, options = {})
  @query = query
  @options = {:comment => ''}.merge(options)
  @proxy = SearchProxy.new(@options)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



68
69
70
# File 'lib/kiosk/indexer/adapter/thinking_sphinx_adapter.rb', line 68

def options
  @options
end

#queryObject (readonly)

Returns the value of attribute query.



68
69
70
# File 'lib/kiosk/indexer/adapter/thinking_sphinx_adapter.rb', line 68

def query
  @query
end

Instance Method Details

#execute_for(model) ⇒ Object



76
77
78
79
80
81
# File 'lib/kiosk/indexer/adapter/thinking_sphinx_adapter.rb', line 76

def execute_for(model)
  query = @proxy.star_query(@query)
  using_options(@options) do
    SearchResults.new(client.query(query, index_names_for(model), @options[:comment]), model, @options)
  end
end