lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Filtering TermDocs and TermEnum
Date Sat, 31 Dec 2005 01:53:48 GMT

: suspect I tried to use the FilterTermDocs and FilterTermEnum classes to
: accomplish this but they don't appear to provide this specific
: functionality (honestly I can't seem to figure out what functionality
: these classes are supposed to provide).

If i remember correctly those classes are provided as thin wrapper base
classes you may use to impliment whatever Filtering you want arround an
existing IndexReader.  I'm not sure why they aren't abstract.

: If anyone has any information on how I may accomplish my goal of
: applying TermDocs and TermEnums to subsets of the index (i.e. only
: documents which match some query) please let me know.

TermDocs is easy, use a HitCollector (or wrap your query in a QueryFilter)
so you an get a BitSet representing each doc that matches you query.  Then
lookup each doc returned by your underlying TermDoc to decide if you want
to expose it or not.

As for a TermEnum ... I can't think of a straight forward way beyond
getting a TermDoc (that you've alread filtered) for each Term and suming
up your own docFreq for each term.

I suspect there must be a better/easier way.


-Hoss


Mime
View raw message