elastic_record 3.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e32b643fefbe0e2111407df6599cf860522315e4
|
4
|
+
data.tar.gz: 0aaf7803267b28fe5b68c82eb759dae1c594bbf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94a5f56253f6fc7bbe185c55ca4552e5e3bcf12bee9bc7aa55539fad0f6857f20225c2933ca4a9ed0a9a7df0a2b356942f6a2375ac976c8450d9798deeb0c900
|
7
|
+
data.tar.gz: 81a1d64dd962321b20e9bc63ff5709b8d5db8f126a28b1b231aa69a4e4fed61124d568dba289afab7fd9e050ffee4df79542f83ccabb6356cf6bfe7c7e0b0097
|
data/elastic_record.gemspec
CHANGED
@@ -63,15 +63,15 @@ module ElasticRecord
|
|
63
63
|
klass.current_elastic_search = previous
|
64
64
|
end
|
65
65
|
|
66
|
+
def search_hits
|
67
|
+
search_results['hits']['hits']
|
68
|
+
end
|
69
|
+
|
66
70
|
private
|
67
71
|
def reset
|
68
72
|
@search_results = @records = nil
|
69
73
|
end
|
70
74
|
|
71
|
-
def search_hits
|
72
|
-
search_results['hits']['hits']
|
73
|
-
end
|
74
|
-
|
75
75
|
def search_results
|
76
76
|
@search_results ||= begin
|
77
77
|
options = search_type_value ? {search_type: search_type_value} : {}
|
@@ -109,6 +109,16 @@ module ElasticRecord
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
+
def search_options!(options)
|
113
|
+
self.search_options_value ||= {}
|
114
|
+
self.search_options_value.merge! options
|
115
|
+
self
|
116
|
+
end
|
117
|
+
|
118
|
+
def search_options(options)
|
119
|
+
clone.search_options!(options)
|
120
|
+
end
|
121
|
+
|
112
122
|
def search_type!(type)
|
113
123
|
self.search_type_value = type
|
114
124
|
self
|
@@ -176,7 +186,8 @@ module ElasticRecord
|
|
176
186
|
build_limit(limit_value),
|
177
187
|
build_offset(offset_value),
|
178
188
|
build_aggregations(aggregation_values),
|
179
|
-
build_orders(order_values)
|
189
|
+
build_orders(order_values),
|
190
|
+
search_options_value
|
180
191
|
].compact
|
181
192
|
|
182
193
|
Arelastic::Nodes::HashGroup.new searches
|
@@ -271,6 +282,7 @@ module ElasticRecord
|
|
271
282
|
order.reverse
|
272
283
|
end
|
273
284
|
end
|
285
|
+
|
274
286
|
end
|
275
287
|
end
|
276
288
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module ElasticRecord
|
2
2
|
class Relation
|
3
3
|
MULTI_VALUE_METHODS = [:extending, :filter, :order, :select, :aggregation]
|
4
|
-
SINGLE_VALUE_METHODS = [:query, :limit, :offset, :search_type, :reverse_order]
|
4
|
+
SINGLE_VALUE_METHODS = [:query, :limit, :offset, :search_options, :search_type, :reverse_order]
|
5
5
|
end
|
6
6
|
end
|
@@ -164,6 +164,13 @@ class ElasticRecord::Relation::SearchMethodsTest < MiniTest::Test
|
|
164
164
|
assert_equal expected, relation.as_elastic['sort']
|
165
165
|
end
|
166
166
|
|
167
|
+
def test_search_options
|
168
|
+
relation.search_options! version: true
|
169
|
+
|
170
|
+
expected = {version: true}
|
171
|
+
assert_equal true, relation.as_elastic[:version]
|
172
|
+
end
|
173
|
+
|
167
174
|
def test_search_type
|
168
175
|
relation.search_type! :count
|
169
176
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Infogroup
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-06-
|
12
|
+
date: 2016-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: arelastic
|