lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: How to combine multiple fielded queries in Lucene
Date Thu, 27 Oct 2005 20:55:06 GMT
You can write an expansionQuery class and enumerate through the fields and send in a query
that does that.
I did something like that not long ago, it would send a query that would first be "" then
AND then OR... 
-----Original Message-----
From: Xin Herbert Wu <>
Sent: Thu, 27 Oct 2005 10:24:34 -0500
Subject: How to combine multiple fielded queries in Lucene

I am developing a search application via Lucene and ran into a problem can
be described as:

  Assume we have document schema with these fields:

  Title, Author, Summary, Publication_date(Date), Content

  The user query is like this:

  Find all documents where either Title field has word "baseball" or Summary
field has word "white sox" and the Pubblication_date is between Jan. 1995
and Dec. 2004. 

  In other words, I want the query somewhat like this:

  (Title = "baseball" OR Summary = "white sox") AND Publication_date =
"199501 TO 200412"


  Based on Lucene API, it seems that a basic query is applied on a single
document field only, but how can I hook up multiple field queries together
with Boolean logic AND or OR as demoed in above example?


Your help is greatly appreciated!





  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message