Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-103281

Enable and test running $rankFusion on a view with non-search input pipelines

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      There are two main cases for supporting running a $rankFusion on a view:
      1) When there are no search stages in any of the input pipelines

      2) Some or all input pipelines have search stages

       

      (1) is easier to enable, and will attempt to be tackled entirely in this ticket.

       

      In this ticket we need to:

      • Make the necessary logic changes in rank fusion to support this
      • Test that it works

       

      Logic changes:

      The current hypothesis is that there is only one (small) change to get this working. Fundamentally, when rank fusion desugars into a set of other stages, all the input pipelines other than the first one, are wrapped in a $unionWith. We need these $unionWiths to produce the correct result on a view. Fortunately, $unionWith already supports this natively, when given the view namespace.

      Right now, we always pass in the collection namespace to the $unionWiths that we de-sugar to. In the case of running on a view, this would incorrectly run on the underlying collection namespace. Instead, we need to pass in the original user provided namespace of the query. This should be available in the expCtx.

       

      Testing:

      As usual, there are two main tests types we want to add:

      • Unit tests:
        • Test that a rank fusion query on a view (with one, and multiple) input pipelines desugars correctly. Especially, in the multi-pipeline case, we want to test that the created $unionWiths specify the correct view namespace
      • js / end-to-end tests
        • We want to test that we get correct results when running a $rankFusion on a view. Testing a $rankFusion with both a single and multiple input pipelines is important
        • Some possible non-search stages that a $rankFusion input pipeline can begin with are: $match, $geoNear, $sort and $sample
          • We should test input pipelines with all these stages, with both single and multi-pipeline $rankFusions

       

      If its discovered during testing that we cannot get correct results, or the queries are error when we do not expect, we should do our best to determine the root cause and schedule follow up tickets to support this (or add the fix in this ticket if its simple)

      Make sure logic is guarded by featureFlagSearchHybridScoringFull.

            Assignee:
            mariano.shaar@mongodb.com Mariano Shaar
            Reporter:
            joseph.shalabi@mongodb.com Joe Shalabi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: