On 1/30/07, Ryan McKinley <[EMAIL PROTECTED]> wrote:
I am working on an SQLUpdatePlugin that needs to set a few fields in
the document and leave the rest as they were.  My plan is to load the
old documents from the current searcher and overwrite any fields set
from SQL.

What is the best way to load a (potentially) large set of documents by
ID?  Should I make one query with a list of all IDs?  make a separate
query for each ID?  Is there a cache i can try to pull them from?

See SolrIndexSearcher:
 public int getFirstMatch(Term t) throws IOException

That returns an internal lucene docid for the first match of a term
(make sure to convert it to internal form first via
FieldType.toInternal()
Then use SolrIndexSearcher.doc(int) to get the document (it will check
the cache).

Trying to retrieve multiple at once doesn't offer a performance
benefit as Lucene needs to seek to each term anyway.

-Yonik

Reply via email to