Problem/Motivation

The Typesense backend does not execute server-side Search API queries. SearchApiTypesenseBackend::search() only handles queries tagged server_index_status (to report the collection document count) and does nothing for a normal query, and getSupportedFeatures() returns an empty array. As a result, $query->execute() returns no results.

This is intentional in the module's current design, which targets the frontend InstantSearch.js pattern (the browser queries Typesense directly with a search-only key). However, it prevents any server-side consumer of a Typesense-backed index from working: custom REST/JSON:API endpoints, jsonapi_search_api, and a Views integration (see #3472613: Integrate with Views) all build and execute a Search API query on the server and therefore return empty.

The "Future of the Search API Typesense Module" BoF feedback (#3553329: Feedback from BoF “Future of Search API Typesense Module”) records a plan for a Drupal proxy that enforces Drupal's access control, which requires exactly this server-side execution.

Proposed resolution

Ship the server-side execution as an opt-in experimental submodule (search_api_typesense_query, lifecycle: experimental) that provides a backend plugin subclassing the main backend. The main backend and its InstantSearch pattern are left unchanged; only servers that select the experimental backend get server-side execution. This keeps default installations unaffected while the behaviour is tested and the API stabilises.

The subclassed backend implements query execution in search(), translating a Search API query into a Typesense search.

Populate the result set from the Typesense response (result count, one result item per hit keyed by the stored Search API item id, extracted field values, and facet extra data), and declare search_api_facets in getSupportedFeatures().

The existing server_index_status handling and the InstantSearch pattern remain unchanged; this adds the server-side path alongside them.

## Related

- Plan: #3553329: Feedback from BoF “Future of Search API Typesense Module” Feedback from BoF "Future of Search API Typesense Module" (Drupal proxy with access control).
- Unblocks: #3472613: Integrate with Views Integrate with Views.

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

noemi created an issue. See original summary.

noemi’s picture

Issue summary: View changes

noemi’s picture

Status: Active » Needs review

  • lussoluca committed 7dc424ec on 1.0.x authored by noemi
    Issue #3611624 by noemi.mancini: Add experimental submodule for server-...
lussoluca’s picture

Assigned: noemi » Unassigned
Status: Needs review » Fixed

Released in 1.2.0-beta3, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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