Improvements to hybrid search scoreDetails tests

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Integration
    • Fully Compatible
    • 0
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      This is a rather open-ended ticket to overall improve the readability and coverage of our scoreDetails tests. Right now we have 4:

      • score_score_details_tests.js
      • score_fusion_score_details_test.js
      • score_fusion_score_details_normalization_methods_test.js
      • ranked_fusion_score_details_tests.js

       

      There are two improvements I would definitely like to see:

      1. Bring 'score_fusion_score_details_test.js' in line with the improvements made in https://github.com/10gen/mongo/pull/38672 to 'ranked_fusion_score_details_test.js' (see if there are even ways to share util functions between these, or more, tests - like checkSearchScoreDetails)
      2. Add test cases to both rank and score fusion scoreDetails on a view

       

      Other than that, just think of ways that all of these files can be more readable, generalized, consolidate logic, improve coverage etc.

       

      Heres a couple other ideas:

       

      Consolidate tests into more generalized / parametrized functions:

      Similar to what was introduced in SERVER-104742 here, see if the successive tests that check different combinations of input pipelines, normalization, weights, etc. can be consolidated into functions that take in the different testing dimensions as arguments; then test the different combinations as function calls like here.

       

      Merge (some or all) scoreDetails expectations into one (or more JSON blobs)

      Instead of asserting the values of the scoreDetails field by field like in this long for loop, see if we can instead define (or compute) the some or all of the scoreDetails as a single JSON blob, and assert the blobs are equal, to reduce the verbosity of the test. Note that the final state might be a combination of asserting blob(s) and some singular field expectations, depending on what were asserting.

       

      Both of these improvements are just general guidelines; there is no exact defined state the tests should end with.

       

      Any other improvements identified when implementing this ticket are also welcome, in the PR or as follow up tickets.

              Assignee:
              Mariano Shaar
              Reporter:
              Joe Shalabi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: