lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miles Barr <>
Subject Re: Réf. : Re: do a simple search
Date Wed, 05 Jan 2005 10:17:22 GMT
On Wed, 2005-01-05 at 10:56 +0100, wrote:
> I have alway another field "type" who is the type of the searched 
> document.
> I must change the request to made search like this
>         type=value AND (shortDesc=value OR longDesc=value)
> but I don't know how to do this ?
> here is the query with fields values
> Field name: type
> Field value: product
> Field name: shortDesc
> Field value: toto
> Field name: longDesc
> Field value: toto
> IndexManager query = type:product shortDesc:toto longDesc:toto

For the type field I suggest using a TermQuery. Is the document type
from a list of defined types? i.e. is it stored as a keyword and hence
doesn't need parsing?

For the other fields I recommend trying out the
DistributingMultiFieldQueryParser class, which isn't in the main distro
yet but can be found here:

It handles all the awkward bits of making sure all fields are searched

Then combine the two query objects in a BooleanQuery.

Miles Barr <>
Runtime Collective Ltd.

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

View raw message