Session
Search API Decoupled
Christoph Breidert
Co-Founder, R&D
Speakers
Artem Dmitriiev
Senior Lead Developer
Agenda
3
Why decoupled search?
Why Search API decoupled?
Decoupled + Search API = Perfect solution
Why not Search API views with Ajax?
Alternatives to default Search API integration with views
Search API pages (https://www.drupal.org/project/search_api_page)
Already decoupled:
Alternatives are based on retrieving Drupal entities
Only views and GraphQL allow direct results from search backend
Our approach: re-use as much as possible
Search API modules family has a lot to offer:
Admin UI for search management
The cost of fast search responses
Only data from the search index is returned, and not from Drupal.
Advantages of not loading entity during search results display
UI module for controlling search display
DEMO
Available UI elements and Layouts
UI submodule provides 3 default layouts: one, two and three columns defined by layout_discovery module. It is possible to create your own layouts, just add category “Search” to definition.
Default UI elements:
Configurable UI Element
Facets
Every endpoint provides search api display plugin that makes it as a base for facets source entity. This way it is possible to create facets per endpoint, the same way as facets per view.
Placing search app on a page
Blocks provided by UI submodule
Search API Search Block with redirect
This block is has search input (optionally with autocomplete) and automatic redirect to search results page on submit.
Search API Endpoint
The main block that includes the JS client. This block exposes drupal settings with all configuration that was done on “UI” tab of an endpoint.
Configuration: drupalSettings.search_api_endpoint
{
"block-searchapiendpointdefault": {
"id": "default",
"label": "Default",
"base_url": "/api/search/default",
"elements": {
"021b5989-314d-45bc-a6bd-bbf28b483d4e": {
"id": "021b5989-314d-45bc-a6bd-bbf28b483d4e",
"type": "search_input",
"weight": 0,
"behaviors": {
"filter": 0,
"url": 0
},
"widget": "autocomplete",
"settings": {
"placeholder": "Search for contents",
"filter": {
"label": "Your search"
}
}
},
…
Response�/api/search/default?f%5Btype_0%5D=type%3Apage&q=fox&page=0
How to contribute
How to contribute
Thank you for joining us!
Stay connected with Drupal Austria for more exciting events, news, and updates!
Also visit our website: https://ddd23.drupalcamp.at/
And don‘t forget to visit our sponsors' stands.
Their support helps make events like this possible!