lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Combining Wildcard and Term Queries?
Date Thu, 28 Aug 2008 03:26:46 GMT

: > That sounds like what I'm after - but how do I get hold of the
: > IndexReader so I can call IndexReader.terms(Term) ?
: > The code where I am doing this work is getFieldQuery(String field,
: > String queryText) of my custom query parser ...
: QueryParser indeed doesn't know about IndexSearchers and IndexReaders, so 
: you either have to do the work outside (whereever you have an 
: IndexSearcher, it lets you access the IndexReader) and hand the results 
: over to your QueryParser via e.g. its constructor. Or you hand over the 
: IndexReader to your QueryParser. That's not really elegant but I don't 
: know a better solution.

it's what the Query.rewrite method is for, it gets an IndexReader as 
input. your custom QueryParser should return a new type of query that 
rewrites itself into a MultiPhraseQuery


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

View raw message