Donna L Gresh wrote:

Also, the terms.close()
statement is outside the scope of terms. I changed to the following, is this correct and should the
FAQ be changed?

try
                {
TermEnum terms = indexReader.terms(new Term("FIELD-NAME-HERE", "")); while ("FIELD-NAME-HERE".equals( terms.term().field()))
                    {
                     // ... collect enum.term().text() ...
                String term = terms.term().text();
                        System.out.println(term);
                     if (!terms.next())
                            break;
                    }
                    terms.close();
                }

I assume the original reason for the finally block was to demonstrate that the TermEnum must be closed, so perhaps it should be

TermEnum terms = null;
try
{
...
}
finally
{
   if (terms != null)
       terms.close();
}

the same applies to TermDocs.  Maybe others?
Antony





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

Reply via email to