Class: Lucene::InclFieldRange

Inherits:
FieldRange
  • Object
show all
Defined in:
lib/knife-solo/resources/patch_cookbooks/chef-solo-search/libraries/search/parser.rb,
lib/knife-solo/resources/patch_cookbooks/chef-solo-search/libraries/vendor/chef/solr_query/lucene_nodes.rb

Overview

we handle ‘[* TO *]’ as a special case since it is common in cookbooks for matching the existence of keys

Instance Method Summary collapse

Methods inherited from FieldRange

#to_array, #transform

Instance Method Details

#leftObject



83
84
85
# File 'lib/knife-solo/resources/patch_cookbooks/chef-solo-search/libraries/vendor/chef/solr_query/lucene_nodes.rb', line 83

def left
  "["
end

#match(item) ⇒ Object



82
83
84
85
86
87
88
89
90
91
# File 'lib/knife-solo/resources/patch_cookbooks/chef-solo-search/libraries/search/parser.rb', line 82

def match(item)
  field = self.elements[0].text_value
  range_start = self.elements[1].transform
  range_end = self.elements[2].transform
  if range_start == "*" and range_end == "*"
    !!item[field]
  else
    raise "Ranges not really supported yet"
  end
end

#rightObject



86
87
88
# File 'lib/knife-solo/resources/patch_cookbooks/chef-solo-search/libraries/vendor/chef/solr_query/lucene_nodes.rb', line 86

def right
  "]"
end