• 
      

    Fix issues when switching and validating search backends.

    Review Request #13389 — Created Oct. 30, 2023 and submitted — Latest diff uploaded

    Information

    Review Board
    release-5.0.x

    Reviewers

    When switching to a new search backend, validation could fail due to the
    search backends attempting to access the "default" connection, which is
    the forwarding backend, and then failing to find the right engine
    information.

    To address this, we now register a new, empty connection alias. We set
    this to the new engine and configuration, and then validate using that.
    This gives the backend a stable connection to hold onto.

    This makes use of modern Haystack's ability to modify and reload a
    registered connection, which is the original purpose of the forwarding
    backend. This is the reason we're not just using the forwarding backend
    for this purpose. However, the forwarding backend is also more complex,
    loading state from the site configuration and handling cache-based
    syncing, with fallbacks on errors. We don't need or want all that, so we
    just work with what Haystack provides us.

    Tested switching between backends, with successful and failed validation
    attempts. I no longer had any issues. I also added temporary logging to
    Haystack to verify configuration and connection states.

    Commits

    Files