I would use a term vector to get this. See IndexReader.getTermFreqVector. You can get the term vector for just field 3.
Grant, thanks, in my case, getTermFreqVector returns null, I dont know why it accepts a docnumber as parameter, what is it? is that the same doc id? if yes it restrict the result for just one document, am I right?
Let's suppose you modify your WhitespaceAnalyzer not to use a WhitespaceTokenizer, but a modified version of the Tokenizer which token-ize not by space but by something else, like '/'. (this is just an example of course). So suppose your real txt document contain : /text2 text3/text4 text5/text6 When you add this document to the index using the tokenizer I explained, terms returned by indexreader.terms should be: text2 text3 text4 text5 text6
Walter, thank you so much, may I ask you a question: if I am using an analyzer, say, XYAnalyzer while indexing, is it affect on how to search? another thing that buffled me is that by using IndexReader.terms() no Analyzer specified so how it possible to do that? thank you again -- Regards, Mohammad -------------------------- see my blog: http://brainable.blogspot.com/