diff options
author | John Keiser <jkeiser@opscode.com> | 2013-06-06 12:43:37 -0700 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-06-06 12:43:37 -0700 |
commit | 1e282ca735d9790fb9dbc4f3f46253082c511fe1 (patch) | |
tree | e383a694b0ab1b21971e944afc2b9630639194e4 /lib/chef_zero/solr/query | |
parent | 9257598ecc89c58f21471d3c3e47acd42d4d0723 (diff) | |
download | chef-zero-1e282ca735d9790fb9dbc4f3f46253082c511fe1.tar.gz |
Fix issue with multiple identical keys, speed up search
Diffstat (limited to 'lib/chef_zero/solr/query')
-rw-r--r-- | lib/chef_zero/solr/query/binary_operator.rb | 5 | ||||
-rw-r--r-- | lib/chef_zero/solr/query/regexpable_query.rb | 3 |
2 files changed, 3 insertions, 5 deletions
diff --git a/lib/chef_zero/solr/query/binary_operator.rb b/lib/chef_zero/solr/query/binary_operator.rb index bd8fa4c..6d9b219 100644 --- a/lib/chef_zero/solr/query/binary_operator.rb +++ b/lib/chef_zero/solr/query/binary_operator.rb @@ -26,12 +26,11 @@ module ChefZero left.matches_doc?(doc) when ':' if left.respond_to?(:literal_string) && left.literal_string - value = doc[left.literal_string] - right.matches_values?([value]) + values = doc[left.literal_string] else values = doc.matching_values { |key| left.matches_values?([key]) } - right.matches_values?(values) end + right.matches_values?(values) end end diff --git a/lib/chef_zero/solr/query/regexpable_query.rb b/lib/chef_zero/solr/query/regexpable_query.rb index 5166309..7435fab 100644 --- a/lib/chef_zero/solr/query/regexpable_query.rb +++ b/lib/chef_zero/solr/query/regexpable_query.rb @@ -14,8 +14,7 @@ module ChefZero attr_reader :regexp def matches_doc?(doc) - value = doc[DEFAULT_FIELD] - return value ? matches_values?([value]) : false + matches_values?(doc[DEFAULT_FIELD]) end def matches_values?(values) values.any? { |value| !@regexp.match(value).nil? } |