I'm starting from a Lucene index which someone else created. I'd like to find all of the words that follow a given word. I've extracted the term (org.apache.lucene.index.Term) of interest from the index, and I can find the documents which contain that term:
segmentTermDocs = segmentReader.termDocs(term);
while (segmentTermDocs.next) {
doc = segmentReader.document(segmentTermDocs.doc);
...
}
Is there a way for me to locate the positions of the term in the document and extract the terms which follow it?