lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vanlerberghe, Luc" <Luc.Vanlerber...@bvdinfo.com>
Subject Cosmetic: Getting rid of an extra \n in TFIDFSimilarity.explainScore output
Date Wed, 26 Nov 2014 15:33:59 GMT
TFIDFSimilarity.explainScore currently outputs an annoying (but harmless of course) extra \n.

It occurs because the freq argument is included as is in the description of the top Explain
node,
whereas freq.getValue() is sufficient. The full freq Explain node is included as a detail
further on anyway...

I attached a patch generated with git, but it's just:
-    result.setDescription("score(doc="+doc+",freq="+freq+"), product of:");
+    result.setDescription("score(doc="+doc+",freq="+freq.getValue()+"), product of:");

Output like this:

  <lst name="explain">
    <str name="0-764629">
5.5484066 = (MATCH) max of:
  5.5484066 = (MATCH) weight(titreSearch:camus in 4158) [DefaultSimilarity], result of:
    5.5484066 = score(doc=4158,freq=1.0 = termFreq=1.0
), product of:
      0.60149205 = queryWeight, product of:
        9.224405 = idf(docFreq=450, maxDocs=1682636)
        0.065206595 = queryNorm
      9.224405 = fieldWeight in 4158, product of:
        1.0 = tf(freq=1.0), with freq of:
          1.0 = termFreq=1.0
        9.224405 = idf(docFreq=450, maxDocs=1682636)
        1.0 = fieldNorm(doc=4158)
</str>
  </lst>

becomes:

  <lst name="explain">
    <str name="0-764629">
5.5484066 = (MATCH) max of:
  5.5484066 = (MATCH) weight(titreSearch:camus in 4158) [DefaultSimilarity], result of:
    5.5484066 = score(doc=4158,freq=1.0), product of:
      0.60149205 = queryWeight, product of:
        9.224405 = idf(docFreq=450, maxDocs=1682636)
        0.065206595 = queryNorm
      9.224405 = fieldWeight in 4158, product of:
        1.0 = tf(freq=1.0), with freq of:
          1.0 = termFreq=1.0
        9.224405 = idf(docFreq=450, maxDocs=1682636)
        1.0 = fieldNorm(doc=4158)
</str>
  </lst>


Mime
View raw message