lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: WildCardTermEnum in Lucene 4.1
Date Thu, 21 Mar 2013 10:47:12 GMT
You can do the following:

Automaton automaton = WildcardQuery.toAutomaton(wildcardTerm); // this transforms the wildcard
syntax with ? and * to a state machine
CompiledAutomaton compiled = new CompiledAutomaton(automaton); // copiles the state machine
TermsEnum enum = compiled.getTermsEnum(terms); // "terms" can be retrieved from AtomicReader

The old WildcardTermsEnum no longer exists, because you can create a finite state meachine
from every wildcard or regexp. The automaton support is part of Lucene's term dictionary,
so the above code uses the index reader to get the filtered terms.

The above code was copied from WildCardQuery and its superclass AutomatonQuery.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> -----Original Message-----
> From: Ramprakash Ramamoorthy [mailto:youngestachiever@gmail.com]
> Sent: Thursday, March 21, 2013 11:31 AM
> To: java-user@lucene.apache.org
> Subject: WildCardTermEnum in Lucene 4.1
> 
> Team,
> 
>        We are in the process of migrating our codebase from lucene 2.3(Yeah, its
> way older) to lucene 4.1. We had previously used WildCardTermEnum
> <http://lucene.apache.org/core/old_versioned_docs/versions/3_0_3/api/all
> /org/apache/lucene/search/WildcardTermEnum.html>
> in
> our code base.
> 
>        I don't find this in 4.1 and did some googling, but in vein. May be some
> one can help with the equivalent of this WildCardTermEnum in 4.1?
> Thanks in advance.
> 
> --
> With Thanks and Regards,
> Ramprakash Ramamoorthy,
> India,
> +91 9626975420


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message