org.apache.lucene.search
Class FuzzyTermEnum

java.lang.Object
  extended by org.apache.lucene.index.TermEnum
      extended by org.apache.lucene.search.FilteredTermEnum
          extended by org.apache.lucene.search.FuzzyTermEnum

public final class FuzzyTermEnum
extends FilteredTermEnum

Subclass of FilteredTermEnum for enumerating all terms that are similiar to the specified filter term.

Term enumerations are always ordered by Term.compareTo(). Each term in the enumeration is greater than all that precede it.


Constructor Summary
FuzzyTermEnum(IndexReader reader, Term term)
          Empty prefix and minSimilarity of 0.5f are used.
FuzzyTermEnum(IndexReader reader, Term term, float minSimilarity)
          This is the standard FuzzyTermEnum with an empty prefix.
FuzzyTermEnum(IndexReader reader, Term term, float minSimilarity, int prefixLength)
          Constructor for enumeration of all terms from specified reader which share a prefix of length prefixLength with term and which have a fuzzy similarity > minSimilarity.
 
Method Summary
 void close()
          Closes the enumeration to further activity, freeing resources.
protected  float difference()
          Equality measure on the term
 boolean endEnum()
          Indiciates the end of the enumeration has been reached
protected  boolean termCompare(Term term)
          The termCompare method in FuzzyTermEnum uses Levenshtein distance to calculate the distance between the given term and the comparing term.
 
Methods inherited from class org.apache.lucene.search.FilteredTermEnum
docFreq, next, setEnum, term
 
Methods inherited from class org.apache.lucene.index.TermEnum
skipTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FuzzyTermEnum

public FuzzyTermEnum(IndexReader reader,
                     Term term)
              throws java.io.IOException
Empty prefix and minSimilarity of 0.5f are used.

Parameters:
reader -
term -
Throws:
java.io.IOException
See Also:
FuzzyTermEnum(IndexReader, Term, float, int)

FuzzyTermEnum

public FuzzyTermEnum(IndexReader reader,
                     Term term,
                     float minSimilarity)
              throws java.io.IOException
This is the standard FuzzyTermEnum with an empty prefix.

Parameters:
reader -
term -
minSimilarity -
Throws:
java.io.IOException
See Also:
FuzzyTermEnum(IndexReader, Term, float, int)

FuzzyTermEnum

public FuzzyTermEnum(IndexReader reader,
                     Term term,
                     float minSimilarity,
                     int prefixLength)
              throws java.io.IOException
Constructor for enumeration of all terms from specified reader which share a prefix of length prefixLength with term and which have a fuzzy similarity > minSimilarity.

Parameters:
reader - Delivers terms.
term - Pattern term.
minSimilarity - Minimum required similarity for terms from the reader. Default value is 0.5f.
prefixLength - Length of required common prefix. Default value is 0.
Throws:
java.io.IOException
Method Detail

termCompare

protected final boolean termCompare(Term term)
The termCompare method in FuzzyTermEnum uses Levenshtein distance to calculate the distance between the given term and the comparing term.

Specified by:
termCompare in class FilteredTermEnum

difference

protected final float difference()
Description copied from class: FilteredTermEnum
Equality measure on the term

Specified by:
difference in class FilteredTermEnum

endEnum

public final boolean endEnum()
Description copied from class: FilteredTermEnum
Indiciates the end of the enumeration has been reached

Specified by:
endEnum in class FilteredTermEnum

close

public void close()
           throws java.io.IOException
Description copied from class: FilteredTermEnum
Closes the enumeration to further activity, freeing resources.

Overrides:
close in class FilteredTermEnum
Throws:
java.io.IOException


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.