lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phillip Rhodes <>
Subject Efficient count of documents by type?
Date Thu, 22 Feb 2007 20:06:38 GMT
I have a query that can return documents that represent different types of things (e.g. books,
movies, coupons, etc)

There is a  "object_type" keyword on each document, so I can tell that a document is a coupon
or a book etc...

The problem is that I need to display a count of each item type that was found.  
For example,  your searched returned: 67 coupons, 54 movies, 28 books...

While I can loop through each document and increment some sort of counter by document type,
sometimes I have over a 2000 documents, and this would mean that the query would be executed
internally by lucene 20 times (for every 100 records).

I am looking at the HitCollector, but since I would need to still get each and every document
(to figure out if it's a coupon vs. a book), I am not sure if there would be any benefits.
 Would using a HitCollector cause the query to be run only 1x vs. 20 for 2000 documents? 
Would that be the only benefit?

I would be interested in hearing what others think about this problem and how to best implement
this functionality with lucene.

Thank you.

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

View raw message