cts.relevanceInfo( [node as Node], [output-kind as String] ) as Object
Return the relevance score computation report for a node.
This function returns
a JavaScript object that contains
details about the
score computation only if the following conditions are met:
The node
parameter or context node is the result
of a
cts.search
call that
included the relevance-trace
option; and the score is
non-zero. For
example, you will not get a report if you use the score-zero
option on your
cts.search
, if the
search returns no results, or if node
is not the result
of
cts.search
.
The score computation reflects the scoring method specified in the
cts.search
expression,
if any. The score-zero
and score-random
methods do not generate a report.
Collecting score computation details with which to generate this report
is costly, so using the relevance-trace
option will
slow down your search significantly.
const x = cts.search("dog", ["relevance-trace"]).toArray(); cts.relevanceInfo(x[0]); => { "score":{ "formula":"(256*scoreSum/weightSum)+(256*qualityWeight*documentQuality)", "computation":"(256*8/1)+(256*1*0)", "value":2048 }, "confidence":{ "formula":"sqrt(score/(256*8*maxlogtf*maxidf))", "computation":"sqrt(2048/(256*8*18*log(1)))", "value":0 }, "fitness":{ "formula":"sqrt(score/(256*8*maxlogtf*avgidf))", "computation":"sqrt(2048/(256*8*18*(0/1)))", "value":0.2357023 }, "uri":"othello.xml", "path":"fn:doc('othello.xml')", "term":{ "weight":0.125, "score":{ "formula":"8*weight*logtf", "computation":"1*8", "value":8 }, "key":"5166487143365525844", "annotation":"word(\"dog\")" } } }