Please don't email me directly.  Keep Lucene questions on Lucene lists.

> From: Winton Davies [mailto:[EMAIL PROTECTED]]
>
> Doug, I had the same question regarding enumerating the documents for 
> accountIDs.
> 
> I dont think I have any field that I can quickly guarantee that a 
> term will work for -- is there anyway I can just do a for i=1 to max 
> doc, get doc(i).accountID ?

If you have an accountId field, then you can enumerate all terms in that
field and, for each such term, enumerate all documents with that term.  This
would look something like:

    TermEnum enum = reader.terms(new Term("accountId", ""));
    try {
      while (enum.term().field().equals("accountId")) {
        String accountId = enum.term().text();
        TermDocs termDocs = reader.termDocs(enum.term());
        try {
          while (termDocs.next()) {
            ... do something with accountId and termDocs.doc() ...
          }
        } finally {
          termDocs.close();
        }
        if (!enum.next()) {
          break;
        }
      }
    } finally {
      enum.close();
    }

Is that what you need?

Doug

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

Reply via email to