add support for facets in autocomplete

Created on 31 March 2025, 14 days ago

Problem/Motivation

If a search exposed form is showing facets as well as a full-text search, then the autocomplete results don't take the currently-selected facets into account.

Steps to reproduce

Proposed resolution

Allow the configuration of the search_api_autocomplete_search entity to include a list of facet exposed filters (using Facets 3!).

Enhance the autocomplete JS to pass the values of those form elements to the autocomplete AJAX request.

Enhance the autocomplete route and controller to accept those parameters, and pass them to the query.

Feature request
Status

Active

Version

1.0

Component

General code

Created by

🇬🇧United Kingdom joachim

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

Comments & Activities

  • Issue created by @joachim
  • 🇬🇧United Kingdom joachim

    In core's autocomplete.js:

          const options = $.extend(
            { success: sourceCallbackHandler, data: { q: term } },
            autocomplete.ajax,
          );
          $.ajax(this.element.attr('data-autocomplete-path'), options);
    

    We'd need to override autocomplete.ajax to include something like

    data: { q: term, *something else here } },
    
Production build 0.71.5 2024