lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dodson <>
Subject nested phrase queries
Date Thu, 06 Apr 2006 12:47:40 GMT
Can phrase queries be nested the same way boolean queries can be nested?

I want a user query to be translated into a boolean query (say, x AND  
(y OR z)), and I want  those terms to be within a certain distance of  
each other (approximately within the same sentence, so the slop would  
be about 7).   I then want to find documents where that phrase is  
within a certain distance of another term (in this case an image  
name).  So in pseudo code I would have something like

PhraseQuery query1
Set slop to 7

PhraseQuery query2
Set slop to 50

Add boolean terms to query1
Add query1 and imageName to query2


I think I could break down my initial boolean query and turn query1  
into two phrase queries which are OR'ed together (so have query1a  
with "x AND y" with slop 7, and query1b with "x AND z" and slop 7,  
both added to a BooleanQuery) but I still need to combine that query  
with the image name in query2.

Thanks for the help.

Mike D

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

View raw message