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
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Nutch-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nutch-general