diff options
-rw-r--r-- | lib/chef_zero/solr/query/unary_operator.rb | 6 | ||||
-rw-r--r-- | spec/search_spec.rb | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/chef_zero/solr/query/unary_operator.rb b/lib/chef_zero/solr/query/unary_operator.rb index fc46c0d..a873932 100644 --- a/lib/chef_zero/solr/query/unary_operator.rb +++ b/lib/chef_zero/solr/query/unary_operator.rb @@ -16,8 +16,7 @@ module ChefZero def matches_doc?(doc) case @operator - when '-' - when 'NOT' + when '-', 'NOT' !operand.matches_doc?(doc) when '+' # TODO This operator uses relevance to eliminate other, unrelated @@ -28,8 +27,7 @@ module ChefZero def matches_values?(values) case @operator - when '-' - when 'NOT' + when '-', 'NOT' !operand.matches_values?(values) when '+' # TODO This operator uses relevance to eliminate other, unrelated diff --git a/spec/search_spec.rb b/spec/search_spec.rb index df0522c..54392a6 100644 --- a/spec/search_spec.rb +++ b/spec/search_spec.rb @@ -24,6 +24,10 @@ describe ChefZero::Solr::SolrParser do search_for('foo:[a TO c]').size.should eq(1) end + it "handles -" do + search_for('-foo:a').size.should eq(1) + end + it "handles wildcard ranges" do search_for('foo:[* TO c]').size.should eq(1) search_for('foo:[c TO *]').size.should eq(1) |