Class: Droonga::Searcher::QuerySearcher
- Inherits:
-
Object
- Object
- Droonga::Searcher::QuerySearcher
- Defined in:
- lib/droonga/searcher.rb
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(context, query) ⇒ QuerySearcher
constructor
A new instance of QuerySearcher.
- #need_output? ⇒ Boolean
- #search(results) ⇒ Object
Constructor Details
#initialize(context, query) ⇒ QuerySearcher
116 117 118 119 120 121 122 |
# File 'lib/droonga/searcher.rb', line 116 def initialize(context, query) @context = context @query = query @result = nil @condition = nil @start_time = nil end |
Instance Method Details
#format ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/droonga/searcher.rb', line 132 def format formatted_result = {} format_count(formatted_result) format_attributes(formatted_result) format_records(formatted_result) if need_element_output?("startTime") formatted_result["startTime"] = @start_time.iso8601 end if need_element_output?("elapsedTime") formatted_result["elapsedTime"] = Time.now.to_f - @start_time.to_f end formatted_result end |
#need_output? ⇒ Boolean
128 129 130 |
# File 'lib/droonga/searcher.rb', line 128 def need_output? @result and @query.has_key?("output") end |
#search(results) ⇒ Object
124 125 126 |
# File 'lib/droonga/searcher.rb', line 124 def search(results) search_query(results) end |