Class: Lucene::Field

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/chef/solr_query/lucene_nodes.rb

Instance Method Summary collapse

Instance Method Details

#to_arrayObject


35
36
37
38
39
# File 'lib/chef/solr_query/lucene_nodes.rb', line 35

def to_array
  field = self.elements[0].text_value
  term = self.elements[1].to_array
  "(F:#{field} #{term})"
end

#transformObject


41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/chef/solr_query/lucene_nodes.rb', line 41

def transform
  field = self.elements[0].text_value
  term = self.elements[1]
  if term.is_a? Phrase
    str = term.transform
    # remove quotes
    str = str[1 ... (str.length - 1)]
    "content:\"#{field}#{SEP}#{str}\""
  else
    "content:#{field}#{SEP}#{term.transform}"
  end
end