Using the Drupal Quant Search module
The optional Drupal Quant Search (quant_search
) submodule allows for creating Quant Search Pages within Drupal. Quant Search leverages the powerful Algolia search platform.
Setup
- Connect Drupal with Quant
- Enable Quant search in Dashboard
- Add the
quantcdn
project to your site, e.g.composer require drupal/quantcdn
- Enable the
quant_search
Drupal module - Go to the Drupal Quant Search admin page (
/admin/config/development/quant/search
) - You should see a
Search is enabled for *project*
message
Search Pages
Unlimited Quant search pages can be added in Drupal. They are pushed to Quant automatically when creating or updating search pages.
- Go to the Drupal Quant Search Pages admin page (
/admin/config/development/quant/search/pages
) - Click the
Add Quant search page
button - Fill in the page details including, at minimum,
Label
andRoute
- The page can be enabled or disabled as needed and defaults to disabled
- The options are fairly self-explanatory, but some notable options are detailed below
- Click the
Save
button to save the search page and send the page to Quant
Manual filters
See the Algolia Filter documentation for details on the types of filters that can be added.
Facets
Search facets can be added and will allow the user to filter the content.
- There are 3 facet styles: checkbox, select, and menu
- The
Content type
andLanguage
facets have no additional configuration - The
Taxonomy
facet requires you to select aVocabulary
- The
Facet heading
is optional, but good for UX and accessibility - For multilingual sites, the
Facet language
can be chosen - To remove any facet, click the
Remove facet
button - To add a facet, fill in the bottom facet details and click the
Add facet
button - Facets can be reordered using drag-and-drop or by changing the
Facet weight
- After changing any facet information, click the
Save
button
Search Index
The Quant Search index contains all the information sent to Quant based on the entity configuration and search pages.
- Go to the Drupal Quant Search admin page for index status (
/admin/config/development/quant/search
) - Click the
Clear index
button to remove all the content from the search index - Go to the Drupal Quant Index admin page to reindex content (
/admin/config/development/quant/search/index
)
Entity Configuration
Some of the search results details are configurable such as the result title, summary, image, and view mode.
- Go to the Drupal Quant
Entity configuration
admin page (/admin/config/development/quant/search/entities
) - The configuration defaults to common search requirements
- Enable or disable
node
(page) andterm
content with the checkboxes - No other configuration is currently available for taxonomy
- Click the
Save configuration
button to save changes
Node Configuration
Search content for nodes
(pages) can be configured per content type.
- There are default options for
Title
,Summary
,Image
, andContent view mode
- For each content type, there are overrides available for these options
- Content types can also be excluded from the search index entirely
- Reindex content if the configuration has changed
Images
To show images in the search results, update the image token to the correct image style for your content type. Example: