lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Bowesman <...@teamware.com>
Subject Performance between Filter and HitCollector?
Date Tue, 13 Mar 2007 04:39:32 GMT
There are (at least) two ways to generate a BitSet which can be used for filtering.

Filter.bits()

   BitSet bits = new BitSet(reader.maxDoc());
   TermDocs td = reader.termDocs(new Term("field", "text");
   while (td.next())
   {
       bits.set(td.doc());
   }
   return bits;

and HitCollector.collect(), as suggested in Javadocs

    final BitSet bits = new BitSet(indexReader.maxDoc());
    searcher.search(query, new HitCollector() {
        public void collect(int doc, float score) {
          bits.set(doc);
        }
      });

SOLR seems to use DocSetHitCollector in places which allows the DocSet interface 
to be used rather then plain old BitSet which allows small sets to be optimised, 
but does anyone know the performance implications of using HitCollector, if 
score is not required, against using Filter and then generating a DocSet?

Antony






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