Hello,
Thanks for the input, I tried the following:
public void handleFreq(String searchstring){
NutchBean bean = new NutchBean();
Query query = Query.parse(searchstring);
Hits hits = bean.search(query, 100);
for(int i = 0; i < hits.getLength(); i++) {
Hit hit = hits.getHit(i);
int docno = hit.getIndexDocNo();
FSDirectory dir =
FSDirectory.getDirectory("C:/nutch-0.7.2/results/crawl/index", false);
IndexReader reader = IndexReader.open(dir);
TermDocs td = reader.termDocs(new Term("contents", searchstring));
int freq=0;
while (td.next()) {
System.out.println("Inside while-loop");
if (td.doc() == docno) {
freq = td.freq();
System.out.println("Document no: " + td.doc());
System.out.println("Term frequency: " + freq);
}
}
}
}
The problem is that "td" seems to be empty since the while-loop is never
entered. I suspect it might be the rows starting with "TermDocs td "or
"FSDirectory " that are causing the problems.
I would very much appreciate any help since I am completely stuck!
Best regards,
Erik
_________________________________________________________________
Lyssna obegränsat på musik! http://www.msn.se/music