Class: ThinkingSphinx::Search::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/search/query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keywords = '', conditions = {}, star = false) ⇒ Query



5
6
7
# File 'lib/thinking_sphinx/search/query.rb', line 5

def initialize(keywords = '', conditions = {}, star = false)
  @keywords, @conditions, @star = keywords, conditions, star
end

Instance Attribute Details

#conditionsObject (readonly)

Returns the value of attribute conditions



3
4
5
# File 'lib/thinking_sphinx/search/query.rb', line 3

def conditions
  @conditions
end

#keywordsObject (readonly)

Returns the value of attribute keywords



3
4
5
# File 'lib/thinking_sphinx/search/query.rb', line 3

def keywords
  @keywords
end

#starObject (readonly)

Returns the value of attribute star



3
4
5
# File 'lib/thinking_sphinx/search/query.rb', line 3

def star
  @star
end

Instance Method Details

#to_sObject



9
10
11
12
13
14
15
# File 'lib/thinking_sphinx/search/query.rb', line 9

def to_s
  (star_keyword(keywords || '') + ' ' + conditions.keys.collect { |key|
     next if conditions[key].blank?

    "@#{key} #{star_keyword conditions[key], key}"
  }.join(' ')).strip
end