searchkick 0.6.0 → 0.6.1

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: 633b6ec4127ea2638b8c05db6c1c1c0b536c4193
4
- data.tar.gz: 69d65f9ecc57e55a954482e03a0998a1f10023dc
3
+ metadata.gz: c81923ad42ba7a15c923bf2b2320ed03894b6a14
4
+ data.tar.gz: 5655aa933464e320c0473b41b9b6a7d644c46dbb
5
5
  SHA512:
6
- metadata.gz: 669dd3262ff71f967b6d0266851eca6f769befc5317289bb058781cf11d6e46af2e47bf9193a60fbc19117b04c5653551b4966bb349d6a9f88f79baa424b0116
7
- data.tar.gz: 024fb4884e8a4d08e3a8954e3d2de0fce7bc7968311da0b64d6c9fe3f24e9b9c6488fa37d11c4c5f4674bdd5e60f72ac4da0ab8d5122c8c60fc07ef8542790c6
6
+ metadata.gz: fb8db1d17809462eb65aacb6662b9157637b68cc99ac417e2b570a3ff589a547b0bd72d66d50cb1b1b1e3a7d469d5787e653976916b9438ec887c44a3a975373
7
+ data.tar.gz: ce0f005d8c74c490007d39a9c65d07455a81ab8d2a5ca0377b9f93d3cf6b7d799f45ce6324ebc5bee3060dea1f6d75a8762105dd9e308289e2c130eb5f1400e8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.6.1
2
+
3
+ - Fixed huge issue w/ zero-downtime reindexing on 0.90 and elasticsearch-ruby 1.0
4
+ - Restore load: false behavior
5
+ - Restore total_entries method
6
+
1
7
  ## 0.6.0
2
8
 
3
9
  - Moved to elasticsearch-ruby
data/README.md CHANGED
@@ -760,7 +760,7 @@ For convenience, this is set by default in the test environment.
760
760
 
761
761
  ## Thanks
762
762
 
763
- Thanks to Karel Minarik for [Tire](https://github.com/karmi/tire), Jaroslav Kalistsuk for [zero downtime reindexing](https://gist.github.com/jarosan/3124884), and Alex Leschenko for [Elasticsearch autocomplete](https://github.com/leschenko/elasticsearch_autocomplete).
763
+ Thanks to Karel Minarik for [Elasticsearch Ruby](https://github.com/elasticsearch/elasticsearch-ruby) and [Tire](https://github.com/karmi/tire), Jaroslav Kalistsuk for [zero downtime reindexing](https://gist.github.com/jarosan/3124884), and Alex Leschenko for [Elasticsearch autocomplete](https://github.com/leschenko/elasticsearch_autocomplete).
764
764
 
765
765
  ## Roadmap
766
766
 
data/lib/searchkick.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "active_model"
2
2
  require "patron"
3
3
  require "elasticsearch"
4
+ require "hashie"
4
5
  require "searchkick/version"
5
6
  require "searchkick/index"
6
7
  require "searchkick/reindex"
@@ -50,11 +50,11 @@ module Searchkick
50
50
  end
51
51
 
52
52
  def retrieve(document_type, id)
53
- client.get_source(
53
+ client.get(
54
54
  index: name,
55
55
  type: document_type,
56
56
  id: id
57
- )
57
+ )["_source"]
58
58
  end
59
59
 
60
60
  protected
@@ -25,7 +25,7 @@ module Searchkick
25
25
  hit_ids = hit_ids.map(&:to_s)
26
26
  records.sort_by{|r| hit_ids.index(r.id.to_s) }
27
27
  else
28
- hits
28
+ hits.map{|hit| Hashie::Mash.new(hit["_source"]) }
29
29
  end
30
30
  end
31
31
  end
@@ -63,6 +63,7 @@ module Searchkick
63
63
  def total_count
64
64
  response["hits"]["total"]
65
65
  end
66
+ alias_method :total_entries, :total_count
66
67
 
67
68
  def current_page
68
69
  options[:page]
@@ -71,15 +72,12 @@ module Searchkick
71
72
  def per_page
72
73
  options[:per_page]
73
74
  end
75
+ alias_method :limit_value, :per_page
74
76
 
75
77
  def total_pages
76
78
  (total_count / per_page.to_f).ceil
77
79
  end
78
80
 
79
- def limit_value
80
- per_page
81
- end
82
-
83
81
  def offset_value
84
82
  current_page * per_page
85
83
  end
@@ -1,3 +1,3 @@
1
1
  module Searchkick
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
data/searchkick.gemspec CHANGED
@@ -19,8 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "activemodel"
22
- spec.add_dependency "elasticsearch"
22
+ spec.add_dependency "elasticsearch", "~> 0.4.11"
23
23
  spec.add_dependency "patron" # persistent http connections for performance
24
+ spec.add_dependency "hashie"
24
25
 
25
26
  spec.add_development_dependency "bundler", "~> 1.3"
26
27
  spec.add_development_dependency "rake"
data/test/sql_test.rb CHANGED
@@ -26,6 +26,7 @@ class TestSql < Minitest::Unit::TestCase
26
26
  assert_equal 2, products.per_page
27
27
  assert_equal 3, products.total_pages
28
28
  assert_equal 5, products.total_count
29
+ assert_equal 5, products.total_entries
29
30
  assert_equal 2, products.limit_value
30
31
  assert_equal 4, products.offset_value
31
32
  end
@@ -250,6 +251,11 @@ class TestSql < Minitest::Unit::TestCase
250
251
  assert_kind_of Hash, Product.search("product", load: false).first
251
252
  end
252
253
 
254
+ def test_load_false_methods
255
+ store_names ["Product A"]
256
+ assert_equal "Product A", Product.search("product", load: false).first.name
257
+ end
258
+
253
259
  def test_load_false_with_include
254
260
  store_names ["Product A"]
255
261
  assert_kind_of Hash, Product.search("product", load: false, include: [:store]).first
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchkick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-22 00:00:00.000000000 Z
11
+ date: 2014-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -26,6 +26,20 @@ dependencies:
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: elasticsearch
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.4.11
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.4.11
41
+ - !ruby/object:Gem::Dependency
42
+ name: patron
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - ">="
@@ -39,7 +53,7 @@ dependencies:
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
- name: patron
56
+ name: hashie
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - ">="