Add support for OpenSearch back end.

Created on 26 July 2024, 6 months ago
Updated 30 July 2024, 5 months ago

I have a project using OpenSearch via search_api_opensearch which needs best bets. I've got it working by adding a new query handler for OpenSearch and making some minor changes to the BestBetsProcessor. MR incoming soon...

Feature request
Status

Needs review

Version

3.0

Component

Code

Created by

🇬🇧United Kingdom rupertj Bristol, UK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @rupertj
  • Merge request !26Draft: Resolve #3464010 "Add support for" → (Open) created by rupertj
  • Pipeline finished with Success
    5 months ago
    Total: 275s
    #237342
  • Pipeline finished with Success
    5 months ago
    Total: 139s
    #238208
  • Pipeline finished with Success
    5 months ago
    Total: 134s
    #238219
  • Pipeline finished with Success
    5 months ago
    #238232
  • Status changed to Needs review 5 months ago
  • 🇬🇧United Kingdom rupertj Bristol, UK

    I don't know if this is ready to merge yet - mainly as I have yet to test if I've broken existing functionality with Solr. This MR is working for me with OpenSearch though.

    If you'd like to run it, you'll need to be using search_api_opensearch 3.x (which is currently still in dev) with the changes from #3454606 applied.

    To explain the changes in this MR:
    All the changes to existing code ate in BestBetsProcessor::preprocessSearchQuery(). I've moved getting the QueryHandler plugin instance to its own private method to clean up preprocessSearchQuery(). I've also added a new method to the QueryHandlerPluginInterface to get the search keys from the query and run any preparation on them that the search backend requires. This is because the keys for OpenSearch come back from the Query object as an array of strings, which made the existing code return early at the check on is_scalar(). The OpenSearch QueryHandler plugin therefore reassembles the array of strings back into the original search term. The Solr QueryHandler plugin just returns the search keys as-is.

    The new code is the OpenSearch query handler, which adds the items to boost or exclude to the query, and an event subscriber for the OpenSearch QueryParamsEvent, which alters the request made to OpenSearch to do the actual boost.

    If one of the maintainers of search_api_best_bets could give this MR a quick review to confirm it's generally acceptable, I'd appreciate it. Once that's done, I'll go back, test for regressions with Solr, etc. Thanks!

  • Pipeline finished with Success
    4 months ago
    Total: 145s
    #291590
Production build 0.71.5 2024