Hi,
can anybody be so kind to tell me if it is possible to search a Term by its position? I search a term (for excample "soccer") and get back the DocId's and positions as follows: TermPositions termPos = reader.termPositions(new Term("contents","soccer")); while(termPos.next()){ int freq = termPos.freq(); for(int i=0; i<freq; i++){ int docNumber = termPos.doc(); int position = termPos.nextPosition(); System.out.println("DocId: "+docNumber+"; Pos:"+position); } Output: DocId: 0; Pos: 1 DocId: 0; Pos: 4 DocId: 0; Pos: 7 DocId: 1; Pos: 3 DocId: 1; Pos: 7 Now I try to get back terms, one position before/after "soccer". I considered to take the Position and increase or decrease it. But I can't find a way to get back a term, according to the given Position. Can anybody help me? Thanks, Renzo