Use TermDocs.seek(Term) to get to the term. That'll position your TermDocs variable at a list, ordered by document ID of the ocurrences of a term. Then TermDocs.skipTo(doc ID) will get you to the list of terms for that document (you have to know what Lucene DocId you care about here.).
Now TermDocs.next() will increment through and you can count. Something like. TermDocs td = IndexReader.termDocs(); td.seek(new Term("field", "value")); td.skipto(docId); int idx = 0; while (td.next()) { if (td.doc != docId) break; ++idx; } idx should contain your count now. Note, the above could be off by one, you'll have to check whether skipto puts you on a document already.... Best Erick On 10/23/06, beatriz ramos <[EMAIL PROTECTED]> wrote:
Hello, I´m working with Lucene. I need to get the number of occurrences of the term in the document. I had seen the documentations ant I don´t find anything. Do you have any idea? Thanks.