I've managed something like this from a slightly different perspective. IndexReader ir = new IndexReader(yourIndex);
String searchTerm = "word"; TermPositions tp = ir.termPositions(new Term("contents", searchTerm); tp.next(); int termFreq = tp.freq(); System.out.print(currentTerm.text()); for (int i=0; i < termFreq; i++) { System.out.print(" " + tp.nextPosition()); } System.out.println(); ir.close(); This will print out something like: word 1 67 104 155 Where the term "word" occurs at positions 1, 67, 104 and 155 in the field "contents" of the index ir. HTH, Andy Roberts On Sunday 10 Apr 2005 15:52, Patricio Galeas wrote: > Hello, > I am new with Lucene. I have following problem. > When I execute a search I receive the list of document Hits. > I get without problem the content of the documents too: > > for (int i = 0; i < hits.length(); i++) { > Document doc = hits.doc(i); > System.out.println(doc.get("content")); > } > > Now, I would like to obtain the List of all Terms (and their corresponding > position) from each document (hits.doc(i)). > > I have experimented creating a second index with the founded documents > (Hits), and analyze it to obtain this information, but the algorithm work > very slow. > > Do you have another idea? > > Thank You for your help! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]