You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by St...@apis-ca.fr on 2005/01/05 11:21:52 UTC
Réf. : Re: Réf. : Re: do a simple search
OK, thanks
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 <mi...@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