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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/lib/searchkick.rb +1 -0
- data/lib/searchkick/index.rb +2 -2
- data/lib/searchkick/results.rb +3 -5
- data/lib/searchkick/version.rb +1 -1
- data/searchkick.gemspec +2 -1
- data/test/sql_test.rb +6 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c81923ad42ba7a15c923bf2b2320ed03894b6a14
|
4
|
+
data.tar.gz: 5655aa933464e320c0473b41b9b6a7d644c46dbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb8db1d17809462eb65aacb6662b9157637b68cc99ac417e2b570a3ff589a547b0bd72d66d50cb1b1b1e3a7d469d5787e653976916b9438ec887c44a3a975373
|
7
|
+
data.tar.gz: ce0f005d8c74c490007d39a9c65d07455a81ab8d2a5ca0377b9f93d3cf6b7d799f45ce6324ebc5bee3060dea1f6d75a8762105dd9e308289e2c130eb5f1400e8
|
data/CHANGELOG.md
CHANGED
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
data/lib/searchkick/index.rb
CHANGED
data/lib/searchkick/results.rb
CHANGED
@@ -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
|
data/lib/searchkick/version.rb
CHANGED
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.
|
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-
|
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:
|
56
|
+
name: hashie
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|