You have to open an IndexReader in order to walk the postings of newly indexed docs.
EG after indexing the doc, ask for a new near-real-time reader (IndexWriter.getReader()), then use the postings API (TermDocs/TermPositions in 3.0.x, but in trunk, with the flex API, DocsEnum/DocsAndPositionsEnum) via IndexReader. Mike On Tue, Apr 20, 2010 at 3:39 AM, Yağız Kargın <xerxes...@gmail.com> wrote: > Hi all, > > I have a question about usage of lucene, I want to figure out how I > can get one or all posting lists, after adding a document to the > index, but without materializing it in files. So after I add a > document (let's say "to be or not to be"), I am asking if I can get > something like this: > > to -> (docID, tf(to)); > be -> (docID, tf(be)); > ... > ... > > Or this code can help better understanding: > > indexWriter.addDocument(doc); > someObject.someMethod(); -> and this will return all posting lists > created for "doc" in some data structure that i can use. > > As far as I know "addDocument(doc)" writes the results gotten from the > "doc" in files, but it will be better if I can get the posting lists > before they are wrote in files. Maybe something like this: > > someObject.giveMeAllPostingListsOfThisDocument(doc); -> and this will > return all posting lists created for "doc" in some data structure that > i can use. > > how can I write methods like those above (if we don't have same kind > of things), or where can I get the desired data from? > > I will be glad if you can help me. > > Best, > Yagiz Kargin > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org