lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: pre computing possible search results narrowing and hit counts on those
Date Wed, 30 Mar 2005 00:19:45 GMT

: I need two other pieces of information for display -
: 1. I want to show a "select" box on the UI, which contains all the
: cities that appear in those 50,000 documents
: 2. Against each city I want to show the count of matching documents.

: My problem is, I do not know how to generate that 'select' list
: without having to actually access each of those  50,000 documents.

the straight forward way to do this, is to use a TermEnumerator to get a
list of all the "cities" in your collection, and then for each one
construct a Filter.  you can then either issue every search N+1 times
(once with no filter for real results, and once with each filter to get
the counts) or you can use the Filter.bits(IndexReader) method directly
with each Filter, and compute the AND of a clone of each with the BitSet
generated using a HitCollector when you do your search -- this assumes you
have access to the IndexReader.  in both cases you can improve performance
by using CachingWrapperFilter.

If you list of vales for that field is too vast to generate, then you
might wnat to take a look at this thread, which i have not read in it's
entirety, but what i did read lead me to believe it's the exact same
problem you describe...

http://www.mail-archive.com/java-dev@lucene.apache.org/msg00034.html

-Hoss


---------------------------------------------------------------------
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