Hi, 

I have written this piece of code to read the index,
mainly to see what terms are in each document and what
the frequency of each term in the document is. This
piece of code correctly calculates the number of docs
in the index, but I don’t know why variable
myTermFreq[] is null. Would you please let me know
your idea bout it?

IndexReader reader = IndexReader.open(myInd);
for (int docNo = 0; docNo < reader.numDocs(); docNo++)
{
TermFreqVector myTermFreq[] =
reader.getTermFreqVectors(docNo);
        if (myTermFreq != null) {
                for (int i = 0; i < myTermFreq.length; i++) {
                        int freq[] = myTermFreq[i].getTermFrequencies();
                        //String terms[]= myTermFreq[i].getTerms();
                for (int j=0;j<terms.length;j++)
                        System.out.println("term"+terms[j]);
                for (int j=0;j<freq.length;j++)
                        System.out.println("freq:"+ freq[j]);
        }
}

}
Thanks



 
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to