: I have a custom query object that extends ContstantScoreQuery. I give it 
: a key which pulls some documents out of a cache. Thinking to make it 
: more efficient, I used DocSet, backed by OpenBitSet or OpenHashSet. 
: However, I need to set the BitSet object for the Lucene filter. Any idea 
: on how to best do this from DocSet? It seems like this is a problem that 
: people have encountered before.

I've never really encountered this particular problem ... typically any 
"sets" i'm dealing with can be passed as "filters" directly to the 
SolrIndexSearcher method -- so I use DocSets.

if I *had* to use a ConstantScoreQuery, i'd probably skip DocSet initially 
and use a BitSet from the get go (the BitSets could still be cashed using  
custom cache).  but you could also just create anew custom constnat 
scoring Query class that used a Scorer that refrenced your DocSet 
directly. 

if you look at the source of ConstantScoreQuery it should be fairly 
obvious how to make something similar backed by a DocSet instead of a 
Filter.

(in future versions of Lucene this will all be moot, as the Filter API 
will no longer require a BitSet and can intead return a "DocIdSet" which 
is essentially just an iterator that Solr's DocSet can implement 
trivially. ... if you look at the trunk version of ConstantScoreQuery it 
already does this ... that class may serve as an even better example of 
implementing a Query that scores based on an o.a.s.search.DocIterator)


-Hoss

Reply via email to