inquisitio 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34e8488ee37d4001d57ec5ed0a318b2532d47f2f
4
- data.tar.gz: 1a20339ae3942c0e5ba5c0828b725b5f8039f6e0
3
+ metadata.gz: ab2d4cf939da96f26e1f9ad688363f9df23ed697
4
+ data.tar.gz: 865070d56b16d662a21a5ea2ae6deb823757cde6
5
5
  SHA512:
6
- metadata.gz: 37b7902705751a607286325de49dd77f331e2ce1c7dd4db4115f09ec40553f88c65f66cde534cbec9691982992a7ede7609b1c613761344857e702cadac1a03d
7
- data.tar.gz: 034fe6edaa9e2cb468765eec84582e4220b4e2d22d0e37ab686e8efc211aad6ad2086f499c29564811a4896714cece5631c1f3b72d65fc58545f1f6faec7a6ee
6
+ metadata.gz: e2458344374731f34cfbfa78c9c662dcf285303cd4a9ff004b5af23693d4cbbd8c2a4ea01cacacf27a1e86c591adf917659c548df00a0a93de1ba87ba9c037ab
7
+ data.tar.gz: e13822c322f83c5d49911505930d4ca05e05c3eddb3f72a4fde1182fc75960d9b83b0df5ec73d19fed22f05deb4753ac6f8a3cd4484f5524355b25851a95ea12
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
- 1.2.2 / 2014-06-03
1
+ 1.2.3 / 2014-06-05
2
+ [FEATURE] Return time taken by queries as time_ms on Searcher for 2013-01-01 api
3
+
4
+ 1.2.2 / 2014-06-05
2
5
  [FEATURE] Return time taken by queries as time_ms on Searcher
3
6
 
4
7
  1.2.1 / 2014-06-03
@@ -125,11 +125,13 @@ module Inquisitio
125
125
  response = Excon.get(search_url)
126
126
  raise InquisitioError.new("Search failed with status code: #{response.status} Message #{response.body}") unless response.status == 200
127
127
  body = JSON.parse(response.body)
128
+ time_ms = body['info']['time-ms'] if Inquisitio.config.api_version == '2011-02-01'
129
+ time_ms = body['status']['time-ms'] if Inquisitio.config.api_version == '2013-01-01'
128
130
  @results = Results.new(body['hits']['hit'],
129
131
  params[:page],
130
132
  params[:per],
131
133
  body['hits']['found'],
132
- body['info']['time-ms'])
134
+ time_ms)
133
135
  rescue => e
134
136
  @failed_attempts += 1
135
137
  Inquisitio.config.logger.error("Exception Performing search: #{search_url} #{e}")
@@ -1,3 +1,3 @@
1
1
  module Inquisitio
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
  end
data/test/results_test.rb CHANGED
@@ -6,6 +6,7 @@ module Inquisitio
6
6
  super
7
7
  @search_endpoint = 'http://my.search-endpoint.com'
8
8
  Inquisitio.config.search_endpoint = @search_endpoint
9
+ Inquisitio.config.api_version = nil
9
10
  @result_1 = {'data' => {'id' => ['1'], 'title' => ["Foobar"], 'type' => ["Cat"]}}
10
11
  @result_2 = {'data' => {'id' => ['2'], 'title' => ["Foobar"], 'type' => ["Cat"]}}
11
12
  @result_3 = {'data' => {'id' => ['20'], 'title' => ["Foobar2"], 'type' => ["Module_Dog"]}}
@@ -32,12 +33,23 @@ module Inquisitio
32
33
  assert_equal @found, searcher.total_entries
33
34
  end
34
35
 
35
- def test_should_return_time_taken
36
+ def test_should_return_time_taken_for_2011
36
37
  searcher = Searcher.where("star_wars")
37
38
  searcher.search
38
39
  assert_equal 3, searcher.time_ms
39
40
  end
40
41
 
42
+ def test_should_return_time_taken_for_2013
43
+ Inquisitio.config.api_version = '2013-01-01'
44
+ body = "{\"status\": {\"rid\" : \"u9aP4eYo8gIK0csK\", \"time-ms\": 4}, \"hits\" : {\"#{@found}\": 33, \"#{@start}\": 0, \"hit\":#{@expected_results.to_json} }}"
45
+ Excon.stubs.clear
46
+ Excon.stub({}, {body: body, status: 200})
47
+
48
+ searcher = Searcher.where("star_wars")
49
+ searcher.search
50
+ assert_equal 4, searcher.time_ms
51
+ end
52
+
41
53
  def test_total_entries_should_proxy
42
54
  searcher = Searcher.where("star_wars")
43
55
  searcher.search
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inquisitio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Walker