Hi list,

I'm trying to get access to the float printed for queryWeight in
IndexSearcher.explain, but it appears to be different from other values I
get from Query.getNormalizedWeight() (and
IndexSearcher.createNormalizedWeight. ... )

Here are the debugging lines...

    System.out.println("QUERY: "+q+" WEIGHT FROM QUERY: " + q.createWeight(
indexSearcher).getValueForNormalization() + "   WEIGHT FROM SEARCHER: " +
indexSearcher.createNormalizedWeight(q).getValueForNormalization());

    System.out.println(indexSearcher.explain(q, results.scoreDocs[i].doc));
... and a sample of what they produce.

QUERY: indexName:"number one" altnames:"number one" WEIGHT FROM QUERY:
1034.287   WEIGHT FROM SEARCHER: 1.0

5.8258076 = (MATCH) sum of:

  5.8258076 = (MATCH) weight(indexName:"number one" in 11910)
[BinarySimilarity], result of:

    5.8258076 = score(doc=11910,freq=1.0 = phraseFreq=1.0

), product of:

      0.6019117 = queryWeight, product of:

        19.357681 = idf(), sum of:

          10.643795 = idf(docFreq=8, maxDocs=138832)

          8.713885 = idf(docFreq=61, maxDocs=138832)

        0.031094206 = queryNorm


I realize I'm getting different numbers because the queryNorm printed in
IndexSearcher.explain is not meant to be reused. However, for my use case,
it provides a good prediction of whether the query terms are all so
frequent in the corpus that I do not want their results.

Is there a way to access the IndexSearcher.explain version of queryWeight?

Thanks,

Liz

Reply via email to