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

Implement isSearchStage / isMongotPipeline functions correctly for rank fusion

    • 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 functions, related to determining if a stage / pipeline involves search / mongot, that we to modify to get $rankFusion with a internal $search pipelines working correctly.

      1)

      The function search_helper_bson_obj::isMongotPipeline needs to updated to return true when the first entry in the pipeline is a rank fusion and the first input pipeline to rank fusion has a search stage.

      This function is crucial to getting $rankFusion working with a search input pipeline on a view, because the proper resolved view pipeline must be computed (here) when running an aggregation pipeline on a view

      2)

      The virtual interface function isSearchStage is also used in a couple places in the search-on-views implementation. Currently, this function for rank fusion always returns true, however, this is not the correct behavior. Similarly, we should only return true if the first input pipeline to rank fusion has a search stage.

      This has to do with what this interface function expects, and how we desugar a rank fusion. A search stage inside of a $unionWith is not considered a search stage, and in rank fusion, all input pipelines other than the first are wrapped in a $unionWith. So if a $rankFusion has no search stages in its first pipeline, but has search stages in other input pipelines, this function would expect false (in the same way this interface would expect false if the user manually wrote out this desugared query).

       

      The implementation / modification of these two functions should be done together to see if there is anyway to consolidate their implementation, as conceptually they are checking the same thing.

       

      Hold off end-to-end testing of $rankFusion on a view with $search input pipelines to a follow up ticket, as it also depends on a separate ticket / PR (https://github.com/10gen/mongo/pull/34139)

      Make sure logic is guarded by featureFlagSearchHybridScoringFull.

            Assignee:
            Unassigned Unassigned
            Reporter:
            joseph.shalabi@mongodb.com Joe Shalabi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: