lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: How create Query
Date Mon, 07 Nov 2005 13:53:49 GMT

On 7 Nov 2005, at 08:27, Anton Potehin wrote:
> I have two fields in the index called "first" and "second". Is it
> possible to make search using following condition: the "first" field
> must have "car" and the "second" field must have "java" or "sun"?  
> If it
> is possible, please tell me how?

Using QueryParser, this expression would give you the query you desire:

     first:car AND second:(java OR sun)

Using the API, you can construct this query using BooleanQuery with  
two required clauses, the first clause being a TermQuery for car on  
the "first" field, and the second clause being a nested BooleanQuery  
with two optional TermQuery's for java and sun on the "second" field.

     Erik



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


Mime
View raw message