Make search_api_autocomplete optional

Created on 21 January 2025, 2 months ago

Problem/Motivation

search_api_autocomplete is responsible for around 280kb of JavaScript being loaded for anonymous users relative to the the base Drupal CMS recipe.

See initial investigation in 🐛 Front-end Performance Suggestions (Via Google Lighthouse) Active .

Possible solution suggested in 📌 Try to load autocomplete and other js when the search button is clicked Active but it's not straightforward.

It's currently not possible to manually uninstall search_api_autocomplete on Drupal CMS once it's installed, because support is hardcoded in drupal_olivero, see 🐛 Search broken without search_api_autocomplete Active - so that issue would need to be fixed to make this possible.

There was some discussion of it being optional in the original issue, but this wasn't implemented in the committed version 📌 Add recipe for search backend Active , looks like the original idea was to move it from a separate recipe to user input in the main search recipe, but then the user input never got added.

Steps to reproduce

Proposed resolution

Either move search autocomplete to a dedicated recipe, or make it configurable in the search recipe.

User interface changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Component

Track: Advanced Search

Created by

🇬🇧United Kingdom catch

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @catch
  • 🇬🇧United Kingdom catch
  • 🇦🇺Australia pameeela

    Finally had a chance to look at this and I think the best course of action is to remove autocomplete from search for now. The calculation for me is that the autocomplete suggesting individual pages is not providing that much value, and it's causing a huge performance hit.

    If we can make it work without changing the performance I think it's a nice addition. But making it a separate recipe does not really solve the problem in my opinion. I still don't think it would be worth the performance hit of adding it. So if we can fix the performance, we can include it by default again. (Although, as noted in 🐛 Search broken without search_api_autocomplete Active , there would be work to ensure that it still could be turned off if needed.)

  • First commit to issue fork.
  • Pipeline finished with Success
    about 2 months ago
    Total: 2774s
    #420755
  • 🇮🇳India annmarysruthy

    Removed autocomplete in MR !499. Kindly review. however even if we enter text in searchbox, relevant results are not displayed. This is already mentioned in https://www.drupal.org/project/drupal_cms/issues/3501069 🐛 Search broken without search_api_autocomplete Active

  • 🇬🇧United Kingdom catch

    This will need additional changes to drupal_cms_olivero per 🐛 Search broken without search_api_autocomplete Active . I think that could be included here if we're removing the whole feature - e.g. take any autocomplete-specific theming out of drupal_cms_olivero.

    Making it work both with and without autocomplete could happen if/when autocomplete is added back and we could repurpose the other issue for that.

  • 🇦🇺Australia pameeela

    Making it work both with and without autocomplete could happen if/when autocomplete is added back and we could repurpose the other issue for that.

    Agreed that's separate, for now we just need to make it work without autocomplete.

Production build 0.71.5 2024