lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: QueryParser over multiple fields
Date Thu, 29 Dec 2005 13:27:53 GMT

On Dec 29, 2005, at 7:42 AM, Gaston wrote:
> in my index every document consistsof multiple fields like  
> url,contents,description etc.I want to search for documents in the  
> url and the contents field.
> My problem is that the constructor of QueryParser only provide one  
> field like "Query query=QueryParser.parse("query",field1,analyzer);"
> Is there an oppurtinity to construct an query Object like "Query  
> query=QueryParser.parse("query",field1,field2,analyzer);" to  
> provide a search over field1 and field2 ?
> I solved this problem in a very unelegant way I think because I  
> introduced two searching procedures in my application, one for  
> field1 and the another one for field2. But this is very bad for the  
> performance because the application has to search two times.

Two options - MultiFieldQueryParser or building an aggregate single  
field to search.  I use the aggregate field option, which entails  
building an additional field for each document, I call it "contents",  
and index _all_ of the searchable text into that field.


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

View raw message