org.apache.lucene.search

Class WildcardTermEnum


public class WildcardTermEnum
extends FilteredTermEnum

Subclass of FilteredTermEnum for enumerating all terms that match the specified wildcard filter term.

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

Version:
$Id: WildcardTermEnum.java,v 1.8 2004/05/11 17:23:21 otis Exp $

Field Summary

static char
WILDCARD_CHAR
static char
WILDCARD_STRING
String equality with support for wildcards

Constructor Summary

WildcardTermEnum(IndexReader reader, Term term)
Creates a new WildcardTermEnum.

Method Summary

void
close()
float
difference()
boolean
endEnum()
protected boolean
termCompare(Term term)
static boolean
wildcardEquals(String pattern, int patternIdx, String string, int stringIdx)
Determines if a word matches a wildcard pattern.

Methods inherited from class org.apache.lucene.search.FilteredTermEnum

close, difference, docFreq, endEnum, next, setEnum, term, termCompare

Methods inherited from class org.apache.lucene.index.TermEnum

close, docFreq, next, skipTo, term

Field Details

WILDCARD_CHAR

public static final char WILDCARD_CHAR
Field Value:
'?'

WILDCARD_STRING

public static final char WILDCARD_STRING
String equality with support for wildcards
Field Value:
'*'

Constructor Details

WildcardTermEnum

public WildcardTermEnum(IndexReader reader,
                        Term term)
            throws IOException
Creates a new WildcardTermEnum. Passing in a Term that does not contain a WILDCARD_CHAR will cause an exception to be thrown.

Method Details

close

public void close()
            throws IOException
Overrides:
close in interface FilteredTermEnum

difference

public final float difference()
Overrides:
difference in interface FilteredTermEnum

endEnum

public final boolean endEnum()
Overrides:
endEnum in interface FilteredTermEnum

termCompare

protected final boolean termCompare(Term term)
Overrides:
termCompare in interface FilteredTermEnum

wildcardEquals

public static final boolean wildcardEquals(String pattern,
                                           int patternIdx,
                                           String string,
                                           int stringIdx)
Determines if a word matches a wildcard pattern. Work released by Granta Design Ltd after originally being done on company time.

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