Make Search API backend agnostic

Created on 30 June 2023, over 1 year ago

Currently this module only works with Search API DB backend for the exact matches.
I was able to make this work with Search API Solr as well (only difference with Search API DB is that the former will put exact matches on top of the results even if they are not returned on the first page. For the latter the exact match will only be put on top if it was found within the first page of results).

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇧🇪Belgium svendecabooter Gent

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

Comments & Activities

  • Issue created by @svendecabooter
  • @svendecabooter opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇧🇪Belgium svendecabooter Gent

    I created a MR that contains this functionality.
    When using search_api_db, the code defaults to the logic that was already in place for this module.
    When using another backend, the exact match is searched within the resultset, and boosted accordingly.

    Let me know if you think this is a good approach, and could be incorporated into a new release of this module.

  • 🇩🇪Germany stefan.korn Jossgrund

    @svendecabooter: Thanks for bringing this up. This was also a refresh for my memory regarding the implementation of this module and the reasons for limitation.

    In a first version of this module I had the issue about paged queries and working only on first page results. As this was not acceptable (made this module on customer behalf) I changed the implementation to what it is now and that led to this limitations.

    I would be interested to make this work backend agnostic and also to work with full text fields. But I suppose only working with first page results is a somewhat serious limitation, not sure if this is desirable. Would need clear communication about this limitation at least.

    Regarding SOLR I supposed that SOLR would have a solution on its own for this. But it's not really out of the box in SOLR as far as I can tell. Here is something about that: https://stackoverflow.com/questions/29103155/solr-exact-match-boost-over...
    Not tested this though. If there is a solution in SOLR itself I would be more reluctant to come up with a (limited) solution in this module, but instead maybe point to the SOLR integrated solution.

  • 🇩🇪Germany stefan.korn Jossgrund

    @svendecabooter: I am merging your changes with some small adjustments.

    I am introducing a configuration option to choose if the exact matches should be removed from subsequent pages.

    And the processor can be used on full text fields for Search API DB backend as well (with the limitations of the generic approach).

    Will keep this in the development branch for now, until I had some more testing. If you are able to test this as well, you're very welcome.

  • 🇨🇦Canada phjou Vancouver 🇨🇦 🇪🇺

    I used the dev branch, for some reason I don't manage to make it work with Solr.
    The exact match is not at the top of the results, I am not sure what I am doing wrong.

  • 🇩🇪Germany stefan.korn Jossgrund

    @phjou: Thanks for reviewing.

    With solr it will only work on the first page of paged displays. There is no solution to this yet.

    A warning message when configuring the processor should point this out..

    It might also be possible to make an exact match searching work with Solr alone, see https://stackoverflow.com/questions/29103155/solr-exact-match-boost-over... - but it is also no trivial task there.

  • Status changed to Fixed about 2 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024