lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: Using analyzers with term queries
Date Tue, 25 Oct 2005 20:03:46 GMT

On 25 Oct 2005, at 09:46, Jeff Rodenburg wrote:
> I don't mean to take the thread off-topic, but is this the recommended
> approach for any of the Query objects, i.e. SpanQuery or PhraseQuery?

In several applications I've built, a Query object is built via the  
API using an Analyzer directly and not using QueryParser.  So I  
believe the answer to your question is yes.  Currently QueryParser  
does not support the SpanQuery family, so you'd need to do this via  
the API or clever overriding of QueryParser methods in a subclass, or  
creating your own parser.

How you create a Query is really dependent on the application - so  
it's hard to say it's "recommended" to do it any particular way though.


> On 10/25/05, Erik Hatcher <> wrote:
>> On 25 Oct 2005, at 07:00, Rob Young wrote:
>>> I am using TermQuery s (and FuzzyQuery s) on the searching side and
>>> I would like to keep doing so. However, I would like to use the
>>> MetaphoneReplacementAnalyzer (from Lucene in Action) when indexing.
>>> How can I allow for this in searching if I'm using TermQuery?
>> You could simply call the metaphone .encode method on the text before
>> constructing a Term for TermQuery. Or, alternatively, you could run
>> the Analyzer on the String (using a StringReader) and capture the
>> token(s) that come back to formulate the TermQuery(s).
>> Erik
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message