Class: ThinkingSphinx::Search::Query
- Inherits:
-
Object
- Object
- ThinkingSphinx::Search::Query
- Defined in:
- lib/thinking_sphinx/search/query.rb
Instance Attribute Summary collapse
-
#conditions ⇒ Object
readonly
Returns the value of attribute conditions.
-
#keywords ⇒ Object
readonly
Returns the value of attribute keywords.
-
#star ⇒ Object
readonly
Returns the value of attribute star.
Instance Method Summary collapse
-
#initialize(keywords = '', conditions = {}, star = false) ⇒ Query
constructor
A new instance of Query.
- #to_s ⇒ Object
Constructor Details
#initialize(keywords = '', conditions = {}, star = false) ⇒ Query
Returns a new instance of Query.
7 8 9 |
# File 'lib/thinking_sphinx/search/query.rb', line 7 def initialize(keywords = '', conditions = {}, star = false) @keywords, @conditions, @star = keywords, conditions, star end |
Instance Attribute Details
#conditions ⇒ Object (readonly)
Returns the value of attribute conditions.
5 6 7 |
# File 'lib/thinking_sphinx/search/query.rb', line 5 def conditions @conditions end |
#keywords ⇒ Object (readonly)
Returns the value of attribute keywords.
5 6 7 |
# File 'lib/thinking_sphinx/search/query.rb', line 5 def keywords @keywords end |
#star ⇒ Object (readonly)
Returns the value of attribute star.
5 6 7 |
# File 'lib/thinking_sphinx/search/query.rb', line 5 def star @star end |
Instance Method Details
#to_s ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/thinking_sphinx/search/query.rb', line 11 def to_s (star_keyword(keywords || '') + ' ' + conditions.keys.collect { |key| next if conditions[key].blank? "#{ key} #{star_keyword conditions[key], key}" }.join(' ')).strip end |