lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Bowesman <>
Subject Re: distinct field values
Date Wed, 15 Oct 2008 05:05:28 GMT
Akanksha Baid wrote:
> I have indexed multiple documents - each of them have 3 fields ( id, tag 
> , text). Is there an easy way to determine the set of tags for a given 
> query without iterating through all the hits?
> For example if I have 100 documents in my index and my set of tag = {A, 
> B, C}. Query Q on the text field returns 15 docs with tag A , 10 with 
> tag B and none with tag C (total of 25 hits). Is there a way to 
> determine that the set of tags for query Q = {A, B} without iterating 
> through all 25 hits.

Another way is to use a HitCollector to collect all the hits into a Map and then 
use TermEnum + TermDocs to walk the tags / docs and see what tag the hit comes 
from.  This would be different to walking the Hits/Documents to fetch the tag 
from the Document.  Not sure if this is very efficient though, depends on the 
Document count.


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

View raw message