summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-06-26 18:03:06 -0600
committerJohn Keiser <jkeiser@opscode.com>2013-06-26 18:03:06 -0600
commita9f0654dabb6aa0f3c59e66abc1a36bfd7767947 (patch)
tree6ffd2c61f4169204e997d7829c7f4dd86361042e
parent12c03cf782feecc9f1020cf3922b182403c2d4a0 (diff)
downloadchef-zero-a9f0654dabb6aa0f3c59e66abc1a36bfd7767947.tar.gz
Fix issue with "NOT a:b" (bind : tighter than NOT)
-rw-r--r--lib/chef_zero/solr/solr_parser.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/chef_zero/solr/solr_parser.rb b/lib/chef_zero/solr/solr_parser.rb
index 5795d1f..6cf955e 100644
--- a/lib/chef_zero/solr/solr_parser.rb
+++ b/lib/chef_zero/solr/solr_parser.rb
@@ -108,8 +108,7 @@ module ChefZero
end
def parse_error(token, str)
- error = "Error on token '#{token}' at #{@index} of '#{@query_string}': #{str}"
- raise error
+ raise "Error on token '#{token}' at #{@index} of '#{@query_string}': #{str}"
end
def read_single_expression
@@ -162,7 +161,12 @@ module ChefZero
# Otherwise it's a term.
else
- Query::Term.new(token)
+ term = Query::Term.new(token)
+ if peek_token == ':'
+ Query::BinaryOperator.new(term, next_token, read_single_expression)
+ else
+ term
+ end
end
end