Is there a problem with the term frequency count (tf) and the IndexSearcher.explain method? I'm searching the following string (fieldname is description) for the term 'salesman' and receive the accompanying explanation from IndexSearcher.explain(.). I've highlighted salesman.
score => 0.3362463 . any agent who fails to meet his quota of sales "leads" (i.e., potential buyers) will lose his job. This intense ultimatum is a boon for the office superstar (Pacino), but a once-successful salesman (Lemmon) now finds himself clinging nervously to faded glory. Political and personal rivalries erupt under pressure when the other agents (Alan Arkin, Ed Harris) suspect the office manager (Kevin Spacey) of foul play. This cauldron of anxiety, tension, and sheer desperation provides fertile soil . 0.0 = (NON-MATCH) fieldWeight(description:salesman in 4), product of: 0.0 = tf(termFreq(description:salesman)=0) 5.379941 = idf(docFreq=5) 0.15625 = fieldNorm(field=description, doc=4) In other queries I also get the same termFreq response of 0. Here's my code: IndexSearcher indexSearcher = new IndexSearcher("."); TermQuery query = new TermQuery(new Term("description", "salesman")); Hits hits = indexSearcher.search(query); int hitCount = hits.length(); int counter = 0; for (Iterator iter = hits.iterator(); iter.hasNext();) { Hit hit = (Hit)iter.next(); System.out.println("score => " + hit.getScore()); Document doc = hit.getDocument(); System.out.println(doc.get("description")); System.out.println(indexSearcher.explain(query, counter).toString()); counter++; } Thanks in advance.