lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miles Barr <mi...@runtime-collective.com>
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, Stephane.Giner@apis-ca.fr 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:

http://issues.apache.org/bugzilla/show_bug.cgi?id=32674

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

Then combine the two query objects in a BooleanQuery.

-- 
Miles Barr <miles@runtime-collective.com>
Runtime Collective Ltd.

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


Mime
View raw message