Thanks Yonik;
Let me twist the same question another way; I'm running Solr embedded, the
uniqueKey set that pre-exists  may be large, is per-query (most likely not
useful to cache it) and is iterable. I'd rather avoid making a string to
build the 'fq', get it parsed, etc.
Would it be as safe & more efficient in a (custom) request handler to create
a DocSet by fetching termDocs for each key used as a Term & use is as a
filter? Or is this just a bad idea?

Pseudo code being:
    DocSet keyFilter(org.apache.lucene.index.IndexReader reader,
            String keyField,
            java.util.Iterator<String> ikeys) throws java.io.IOException {
        org.apache.solr.util.OpenBitSet bits = new
org.apache.solr.util.OpenBitSet(reader.maxDoc());
        if (ikeys.hasNext()) {
            org.apache.lucene.index.Term term = new
org.apache.lucene.index.Term(keyField,ikeys.next());
            org.apache.lucene.index.TermDocs termDocs =
reader.termDocs(term);
            if (termDocs.next())
                bits.fastSet(termDocs.doc());
            while(ikeys.hasNext()) {
                termDocs.seek(term.createTerm(ikeys.next()));
                if(termDocs.next())
                    bits.fastSet(termDocs.doc());
            }
            termDocs.close();
        }
        return new org.apache.solr.search.BitDocSet(bits);
    }

Thanks again

Yonik Seeley wrote:
> 
> On 6/17/07, Henrib <[EMAIL PROTECTED]> wrote:
>> Merely an efficiency related question: is there any other way to filter
>> on a
>> uniqueKey set than using the 'fq' parameter & building a list of the
>> uniqueKeys?
> 
> I don't thnik so...
> 
>> In 'raw' Lucene, you could use filters directly in search; is this (close
>> to) equivalent efficiency wise?
> 
> Yes, any fq params are turned into filters.
> 
> -Yonik
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Filtering-on-a-%27unique-key%27-set-tf3935694.html#a11178089
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to