lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carl...@bookandhammer.com
Subject Re: Searching multiple fields in one Index of Documents
Date Tue, 12 Feb 2002 15:06:16 GMT
Hi Charles,
Currently Lucene does not give you a query which will search all fields.
The easiest way to do this is to great a queryString will all the fields 
based on the enteredSearchString.

So if someone enters "foobar" then convert this into
category:foobar OR body:foobar
where the format is [fieldname]:[query string]
Of course you can use AND or OR depending on what you want to accomplish.

Hope that helps.

--Peter

On Monday, February 11, 2002, at 04:39 PM, Charles Harvey wrote:

> I have a working installation of Lucene running against indexes created 
> by a database query.
> Each Document in the Index contains fifteen or twenty fields. I am 
> currently searching only one field (that contains concatenated database 
> columns) because I cannot figure out how to search multiple fields. So:
>
> How can I use Lucene to search more than one field in an Index of 
> Documents?
>
> eg:
> field CATEGORY is(or contains) 'bar'
> AND
> field BODY contains 'foo'
>
>
>
>
> _________________
>
> "The trouble with the rat-race is that even if you win you're still a 
> rat."
> --Lily Tomlin
> _________________
> Charles Harvey
> Developer
> http://www.philly.com
> Wk: 215 789 6057
> Cell: 215 588 0851
>
>
> --
> To unsubscribe, e-mail:   <mailto:lucene-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:lucene-user-
> help@jakarta.apache.org>
>
>


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


Mime
View raw message