elastic_record 0.6.9 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc
CHANGED
@@ -58,6 +58,11 @@ An Arelastic object can also be passed in, working similarily to Arel:
|
|
58
58
|
|
59
59
|
Helpful Arel builders can be found at https://github.com/matthuhiggins/arelastic/blob/master/lib/arelastic/builders/filter.rb.
|
60
60
|
|
61
|
+
Lastly, negation is made easy with negate:
|
62
|
+
|
63
|
+
# Status is not active
|
64
|
+
search.negate(status: 'active')
|
65
|
+
|
61
66
|
=== Querying
|
62
67
|
|
63
68
|
To create a query string, pass a string to search.query:
|
data/elastic_record.gemspec
CHANGED
@@ -57,6 +57,24 @@ class ElasticRecord::Relation::SearchMethodsTest < MiniTest::Spec
|
|
57
57
|
assert_equal expected, relation.as_elastic['query']
|
58
58
|
end
|
59
59
|
|
60
|
+
def test_negate
|
61
|
+
search = relation.negate("prefix" => {"name" => "Jo"})
|
62
|
+
|
63
|
+
expected = {
|
64
|
+
"constant_score" => {
|
65
|
+
"filter" => {
|
66
|
+
"not" => {
|
67
|
+
"prefix" => {
|
68
|
+
"name" => "Jo"
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
assert_equal expected, search.as_elastic['query']
|
76
|
+
end
|
77
|
+
|
60
78
|
def test_query_with_only_query
|
61
79
|
relation.query!('foo')
|
62
80
|
|
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: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: arelastic
|