Appearance
Install
sh
composer require drupal/search_web_componentsSearch Web Components searches through Search API. The site needs a Search API server and an index with the content indexed.
The main module provides the components and connects them to a Search API Decoupled endpoint. Submodules provide the rest, based on what the site needs:
| Submodule | Provides | Enable it when | Requires |
|---|---|---|---|
Search Web Components: Blocks (search_web_components_block) | A block for each component. | The page is built in Layout Builder. | Search Web Components: Facets |
Search Web Components: Layouts (search_web_components_layout) | Layout Builder layouts for the search components. | The page is built in Layout Builder. | |
Search Web Components: Facets (search_web_components_facets) | Facet components. | The page has facets. | Facets |
Search Web Components: Canvas (search_web_components_canvas), experimental | Canvas-compatible components. | The page is built in Drupal Canvas. | Drupal Canvas |
Search Web Components: Spellcheck (search_web_components_spellcheck), experimental | Spelling suggestions for the Did You Mean block. | The search should suggest a corrected keyword. | Search API Spellcheck with the patch below |
A page that prints the components from Twig needs only the main module, plus Search Web Components: Facets when it has facets. See Placing components from Twig.
For sites not using Drupal, see Install the npm package.
The Spellcheck patch
The Spellcheck submodule needs Search API Spellcheck with the change from #3499281 Make spellcheck available as an index processor. Download the merge request's diff into the project, e.g., as patches/search_api_spellcheck-3499281.diff, and apply it with Composer Patches:
json
"extra": {
"patches": {
"drupal/search_api_spellcheck": {
"#3499281 Make spellcheck available as an index processor": "patches/search_api_spellcheck-3499281.diff"
}
}
}