lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael D. Curtin" <>
Subject Re: How to retrieve distinct field matches?
Date Fri, 16 Dec 2005 15:58:22 GMT
Plat wrote:

> Basically, pretend I do a regular search for "category:fiction". After
> stemming/etc, this would match any Document with a category of
> "fiction", "non-fiction", "fictitious", etc. All 900+ of them.
> BUT as far as the results are concerned, I'm not actually interested
> in each Document that was hit, nor about any other field besides the
> "category" field. I just want a list of the unique categories that
> matched the search string of "fiction".
> ...
> Again, I want to find a *unique* list of "category" field values that
> match certain query text.
> I know this can be done using a second index, but wanted to be sure
> there isn't an obvious, less-hacky way first. I'm used to Lucene
> surprising me with sneaky efficiencies.

Ah, yes, I misunderstood what you are trying to do.  How about doing a 
simple string search (like String.indexOf) on the contents of a TermEnum 
from IndexReader.terms()?  Since you've only got a few thousand distinct 
values, that should be pretty fast.


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

View raw message