Hi Andi, Here is how you could retrieve positions from your document:
Terms termVector = indexReader.getTermVector(docId, fieldName); TermsEnum reuse = null; TermsEnum iterator = termVector.iterator(reuse); BytesRef ref = null; DocsAndPositionsEnum docsAndPositions = null; while ((ref = iterator.next()) != null) { docsAndPositions = iterator.docsAndPositions(null, docsAndPositions); // beware that docsAndPositions will be null if you didn't index positions if (docsAndPositions.nextDoc() != 0) { // you need to call nextDoc() to have the enum positioned throw new AssertionError(); } final int freq = docsAndPositions.freq(); // number of occurrences of the term for (int i = 0; i < freq; ++i) { final int position = docsAndPositions.nextPosition(); // 'position' is the i-th position of the current term in the document } } I hope this helps. -- Adrien --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org