We have a system where I'll be given 10 or 20 unique keys.

I assume you mean you have one unique-key field, and you are given 10-20 values to find for this one field?

Internally I'm creating a new Term and then calling IndexReader.termDocs() on this term. Then if termdocs.next() matches then I'll return this document.

Are you calling reader.termDocs() inside a (tight) loop? It might be better to create one TermEnum, and use "seek". Something like this:

reader = ...;
td = reader.termDocs();

String[] keys = ....; // your unique keys;
sort(keys); // this probably helps seek() below

for (key in keys) {
    Term t = new Term("unique", key);
    td.seek(t);
    if (td.next()) {
        // found a match
    }
}

I'm pretty sure that will work. And if you can avoid the multi- threading issues, you might try and use the same TermDocs object for as long as possible (that is, move it up out of as many tight loops as you can).

=Matt

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to