Ok, I've got it all figured out now. This google search: "nutch org.apache.nutch.searcher.NutchBean" "Total hits: 0" got me to this forum page: http://www.mail-archive.com/[email protected]/msg07522.html It said: "Check to see if your nutch-site.xml file has the correct path to your crawl directory inside the 'searcher.dir" property." So I added that and then I got total hits > 0.
Just summarize: I had tried to upgrade SearchApp from http://today.java.net/pub/a/today/2006/02/16/introduction-to-nutch-2.html to nutch 0.9 and I finally figured it all out as detailed in this thread. One important observation I make after going through lots of code: SearchApp isn't very different from main() in NutchBean.java! Here: /** For debugging. */ public static void main(String[] args) throws Exception { String usage = "NutchBean query"; if (args.length == 0) { System.err.println(usage); System.exit(-1); } Configuration conf = NutchConfiguration.create(); NutchBean bean = new NutchBean(conf); Query query = Query.parse(args[0], conf); Hits hits = bean.search(query, 10); System.out.println("Total hits: " + hits.getTotal()); int length = (int)Math.min(hits.getTotal(), 10); Hit[] show = hits.getHits(0, length); HitDetails[] details = bean.getDetails(show); Summary[] summaries = bean.getSummary(details, query); for (int i = 0; i < hits.getLength(); i++) { System.out.println(" "+i+" "+ details[i] + "\n" + summaries[i]); } } It was a bit of a drama to get this working, but there it is. --Kai Middleton ____________________________________________________________________________________ Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545433
