Move autocomplete feature to a submodule

Created on 9 September 2023, about 1 year ago
Updated 30 September 2023, about 1 year ago

Problem/Motivation

We have an untested autocomplete support coded in the module, however the usage depends on whether search_api_autocomplete is installed which is a separate module. This makes the current code potentially bloated as users might not need autocomplete functionality. Also adding the search_api_autocomplete dependency to our module is not valid since users would be forced to install the dependency even if they do not use it.

We can move the autocomplete support to a separate submodule, add the search_api_autocomplete dependency there and let the users install the submodule if they wish to utilize autocomplete functionality.

Proposed resolution

Move the autocomplete code to a new submodule search_api_meilisearch_autocomplete using a service as SearchApiAutocompleteSuggester plugin currently does not make sense. This was already suggested in #3192031: Move autocomplete suggestion to the suggester class but was closed with no explanation.

Remaining tasks

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇸🇮Slovenia bcizej

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

Comments & Activities

  • Issue created by @bcizej
  • First commit to issue fork.
  • @deaom opened merge request.
  • Status changed to Needs work about 1 year ago
  • 🇸🇮Slovenia DeaOm

    Locally test are passing for me, but for whatever reason they are not here, so setting the status to needs work.

  • Status changed to Needs review about 1 year ago
  • 🇸🇮Slovenia DeaOm

    The custom suggester did not make sense for what meili provides and what is already implemented. But because not all users will want to enable autocomplete, moving it to a sub-module was the only viable option, because of the dependency to search_api_autocomplete (now it's only needed if you want to enable the search_api_meilisearch_autocomplete module.)
    Ready for review.

  • Status changed to RTBC about 1 year ago
  • Tests are passing, it correctly works with full-text searches. I think this can be merged. Moving it to RTBC.

  • Status changed to Needs work about 1 year ago
  • After trying to uninstall the module. I got the next error:

    Fatal error: Trait "Drupal\search_api_meilisearch_autocomplete\BackendTrait" not found in /var/www/html/web/modules/custom/search_api_meilisearch-3386267/src/Plugin/search_api/backend/SearchApiMeilisearchBackend.php on line 39
    
  • Status changed to Needs review about 1 year ago
  • 🇸🇮Slovenia DeaOm

    Ready for review again.

  • Status changed to RTBC about 1 year ago
  • The module still works, tests pass and now I can uninstall the module. Switching to RTBC.

  • Status changed to Needs review about 1 year ago
  • 🇸🇮Slovenia bcizej

    Rebased, cleaned up the code and used query limit from settings.

  • Status changed to Needs work about 1 year ago
  • 🇸🇮Slovenia bcizej

    Needs a test for when autocomplete settings has a min/max limit set to make sure this works properly.

  • Status changed to Needs review about 1 year ago
  • 🇸🇮Slovenia DeaOm

    Added the limit option to the test, ready for review.

  • Status changed to RTBC about 1 year ago
  • The tests are still passing both here and locally. Just in case made sure the submodule still works. Setting it to RTBC.

    • bcizej committed 20268a20 on 2.x authored by DeaOm
      Issue #3386267 by DeaOm, bcizej, admirlju: Move autocomplete feature to...
  • Status changed to Fixed about 1 year ago
  • 🇸🇮Slovenia bcizej

    Merged, thanks.

  • 🇸🇮Slovenia bcizej

    I've added an "Autocomplete" option to the "Component" dropdown so any issues regarding autocomplete submodule can use that option.

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

Production build 0.71.5 2024