lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: Using QueryParser with a single field
Date Wed, 20 Jul 2005 21:00:27 GMT

On Jul 19, 2005, at 8:10 AM, Eyal wrote:

> Hi,
> In my client application I allow the user to build a query by  
> selecting a
> field from a combobox and entering a value to search by.
> I want the user to enter free text queries for each field, but I  
> don't want
> to parse it myself so I thought I'd use QueryParser for that. My  
> problem is
> that if the user will (for example) select a field called author  
> and enter
> the following text: 'John content:MyContent'
> QueryParser will build a query for author:John OR  
> content:MyContent. I want
> QueryParser to ignore other fields.
> Any method in QueryParser to allow that? If not - any other  
> suggestions?

There is no such switch in QueryParser to disable fielded queries.  A  
custom QueryParser would be needed to make this happen.

If you only need TermQuery and PhraseQuery you could do without  
QueryParser altogether in this situation and process (not quite  
"parse") the text fields by building up the appropriate query.


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

View raw message