Problem/Motivation

For the attributes mentioned in the title, there is a check if the search API config is different than Meilisearch settings. The generated attributes by the backend code are not necessarily in the same order as Meilisearch returns them. This potentially causes all settings to always update.

Steps to reproduce

  1. Install and configure the module.
  2. Prepare an index with some fields.
  3. Open the module code, with some kind of debugger.
  4. Place breakpoints after the comparisons.
  5. Go to the Search API field settings, without changing anything, just click "Save Changes".
  6. Your code execution has a big change to stop at one or all of the breakpoints.

Proposed resolution

Since the order of these values is not important, using sort before or in the if statement should do the job.

Remaining tasks

Fix the code

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

admirlju created an issue. See original summary.

admirlju’s picture

Status: Active » Needs review
deaom’s picture

I do agree for the order not being important for the searchable and filterable attributes, but for sortable it's important that they keep the order in which they are set in the search API fields, as if I'm not mistaken, the first one added (on top) is the one with more "importance" when sorting, but I could be wrong, so leaving this to needs review.

admirlju’s picture

Looking at the meilisearch documentation. The order of sorting attributes is not important when setting them up, this setting only sets what values can be used for sorting. The sorting order is done at search time, so values in the "sort" parameter must be correctly ordered.

deaom’s picture

Status: Needs review » Reviewed & tested by the community

Thank you for looking into it. Did test the code and it's working as expected and I see no issue with this being sorted before comparison is made, marking it as RTBC.

  • bcizej committed e130b973 on 1.x authored by admirlju
    Issue #3386972 by admirlju, DeaOm: Serchable, sortable and filterable...
bcizej’s picture

Version: 1.x-dev » 2.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Thanks, merged but needs to be applied to 2.x as well.

  • bcizej committed e4332d5d on 2.x authored by admirlju
    Issue #3386972 by admirlju, DeaOm: Serchable, sortable and filterable...
bcizej’s picture

Status: Patch (to be ported) » Fixed

Merged to 2.x as well.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.