lib/inquisitio/searcher.rb in inquisitio-1.2.2 vs lib/inquisitio/searcher.rb in inquisitio-1.2.3
- old
+ new
@@ -123,14 +123,16 @@
Inquisitio.config.logger.info("Performing search: #{search_url}")
response = Excon.get(search_url)
raise InquisitioError.new("Search failed with status code: #{response.status} Message #{response.body}") unless response.status == 200
body = JSON.parse(response.body)
+ time_ms = body['info']['time-ms'] if Inquisitio.config.api_version == '2011-02-01'
+ time_ms = body['status']['time-ms'] if Inquisitio.config.api_version == '2013-01-01'
@results = Results.new(body['hits']['hit'],
params[:page],
params[:per],
body['hits']['found'],
- body['info']['time-ms'])
+ time_ms)
rescue => e
@failed_attempts += 1
Inquisitio.config.logger.error("Exception Performing search: #{search_url} #{e}")
if @failed_attempts < Inquisitio.config.max_attempts