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.
Issue fork search_api_typesense-3611624
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
Comment #2
noemi commentedComment #4
noemi commentedComment #6
lussolucaReleased in 1.2.0-beta3, thanks!