Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-7395

Query Norm and coordination factor not calculated when PerFieldSimilarityWrapper is used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.3.1, 5.4.1
    • 6.2
    • None
    • None
    • New

    Description

      If any kind of similarity is defined and therefore the SchemaSimilarityFactory is defined as global similarity the queryNorm is always 1.0

      The PerFieldSimilarityWrapper delegates some of the methods to the desired Similarity but misses to delegate public float queryNorm(float valueForNormalization)
      Instead the IndexReader calls this method on the base class Similarity.

      The result is that all scores are much higher.

      I created a custom similarity which extends ClassicSimilarity.
      To have the calculation fixed I did a local "hotfix" which always uses the default similarity. Also wrong for some cases but fine in my scenario.

      @Override
      public float queryNorm(float valueForNormalization)

      { return get("").queryNorm(valueForNormalization); // use default similarity to calculate }

      Attachments

        1. LUCENE-7395.patch
          15 kB
          Uwe Schindler

        Issue Links

          Activity

            People

              uschindler Uwe Schindler
              saschamarkus Sascha Markus
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: