Class: LuceneQuery::Fuzzy

Inherits:
Object
  • Object
show all
Defined in:
lib/lucene_query.rb

Instance Method Summary collapse

Constructor Details

#initialize(term, boost = nil) ⇒ Fuzzy

Returns a new instance of Fuzzy.



111
112
113
# File 'lib/lucene_query.rb', line 111

def initialize(term, boost=nil)
  @term, @boost = term, boost
end

Instance Method Details

#to_luceneObject



115
116
117
118
119
# File 'lib/lucene_query.rb', line 115

def to_lucene
  @term.split(/\s+/).map { |t|
    @boost ? "%s~%1.1f" % [t.escape_lucene, @boost] : "%s~" % t.escape_lucene
  } * " "
end