diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-12-14 10:26:23 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-14 10:26:23 -0800 |
commit | dee9ffe7583cad4a5b517bfd572118cd0fcc1501 (patch) | |
tree | 463252890e7c6ad2da5f1497c0287cdf03bd8a29 | |
parent | f89721bdc30e63485c7e56cf5527ac66213d3e0b (diff) | |
parent | f18b35f4a94ae163a3f4467d03d9b5a89ea3aee7 (diff) | |
download | chef-zero-dee9ffe7583cad4a5b517bfd572118cd0fcc1501.tar.gz |
Merge pull request #233 from chef/tm/support_bang_operator
support ! in searches
-rw-r--r-- | lib/chef_zero/solr/query/unary_operator.rb | 4 | ||||
-rw-r--r-- | lib/chef_zero/solr/solr_parser.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef_zero/solr/query/unary_operator.rb b/lib/chef_zero/solr/query/unary_operator.rb index e83683c..2f34653 100644 --- a/lib/chef_zero/solr/query/unary_operator.rb +++ b/lib/chef_zero/solr/query/unary_operator.rb @@ -16,7 +16,7 @@ module ChefZero def matches_doc?(doc) case @operator - when "-", "NOT" + when "-", "NOT", "!" !operand.matches_doc?(doc) when "+" # TODO This operator uses relevance to eliminate other, unrelated @@ -27,7 +27,7 @@ module ChefZero def matches_values?(values) case @operator - when "-", "NOT" + when "-", "NOT", "!" !operand.matches_values?(values) when "+" # TODO This operator uses relevance to eliminate other, unrelated diff --git a/lib/chef_zero/solr/solr_parser.rb b/lib/chef_zero/solr/solr_parser.rb index 2bf2125..980a75f 100644 --- a/lib/chef_zero/solr/solr_parser.rb +++ b/lib/chef_zero/solr/solr_parser.rb @@ -180,7 +180,7 @@ module ChefZero end def unary_operator?(token) - [ "NOT", "+", "-" ].include?(token) + [ "NOT", "+", "-", "!" ].include?(token) end def binary_operator?(token) |