lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Mercier <benoit.merc...@member.fsf.org>
Subject BooleanQuery and SpanQuery : how to get « combined » spans?
Date Tue, 23 Mar 2010 04:58:16 GMT
Hi,

I would like to write a query composed of a BooleanQuery (several 
clauses) and a SpanQuery (SpanNearQuery),  where both are mandatory.  
Sounds simple but I have to work on spans returned by this query.

I know that I could use a Filter, but my goal is to get the spans from 
the « combined » query : BooleanQuery + SpanQuery.  Even if I filter my 
BooleanQuery with the SpanQuery, spans returned by the 
SpanQuery.getSpans(reader) are not « filtered » by the BooleanQuery.  
Since executing the query is not needed to get spans from a SpanQuery I 
understand this behaviour.

My current implementation first runs the BooleanQuery filtered by the 
SpanQuery.  I then get the spans from the SpanQuery and remove from them 
all docs that are not in the score docs returned by the filtered 
BooleanQuery. Is there a more efficient, simple or clever way to reach 
the same goal?

Thank you very much in advance for your advices.

Best regards,

mercibe

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message