Filter by langcode as default does not work

Created on 25 July 2025, about 2 months ago

Problem/Motivation

In a multilingual website, we need to display the translated results based on the language I'm browsing the website in.
In the search.js, there is this snippet that should handle that

      search.addWidgets([
        instantsearch.widgets.configure({
          hitsPerPage: settings.search_api_typesense.hits_per_page,
          // The facetFilters are used to filter the results based on the
          // current language code. This is useful for multilingual sites.
          ...(settings.search_api_typesense.current_langcode && {
            facetFilters: [
              `langcode:${settings.search_api_typesense.current_langcode}`,
            ],
          }),
        }),
....

But it isn't enough, because when I interact with facet filters via web UI, the langcode filter disappears from the Typesense query.

Steps to reproduce

  1. Install and configure the Search API Typesense module using Drupal umami distro
  2. Create an index and add some facet filters in the schema
  3. Place a Typesense Search Block in the content region
  4. Load the page containg the search block and interact with the filters

Proposed resolution

TBD

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇮🇹Italy robertoperuzzo 🇮🇹 Tezze sul Brenta, VI

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

Comments & Activities

Production build 0.71.5 2024