Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Search API Best Bets

687 sites Security covered
View on drupal.org

This module allows editors to configure specific search terms to elevate or exclude certain content. It integrates with entity forms and uses Search API processors to influence search queries, with initial support for Solr backends.

Introduction

This module let editors configure search terms per entity that should trigger
elevate (best bets) or exclude when users is searching the site.

The entity form integration is using a custom form field that can be added to
all entity bundles in Drupal.

The search backend integration is using Search API processor plugin for looking
up entities for elevation or exclusion during the search query generation. The
per backend type query manipulation is handled in Best Bets QueryHandler
plugins.

The module comes with a QueryHandler plugin for Solr utilizing
elevateIds and exlcudeIds search query parameters in Apache Solr. Plugins
for other backends can be implemented in third part modules.

Notice: the module does, at the moment, not support generation of elevate.xml
for Apache Solr. Or similar solutions for other search backends. It is fully
search query based!

Requirements

Installation

Install as you would normally install a contributed drupal module. See: https://www.drupal.org/documentation/install/modules-themes/modules-8 for further information.

Configuration

After installation add a field of the type "Search API Best Bets" to one or more
entity bundles (e.g. content types) where you want best bets support.

When the field has been added go to your Search API index and choose the
Processors tab. Enable the processor "Search API Best Bets" and edit the
processor settings. Choose the field you just added to your entity bundles
and choose a Query handler plugin. Only Solr is supported by the module it self.

In the processor settings is it also possible to configure how the elevated
flag on the item object should be set. It can either be set based on data
received back from the search backend (e.g. field [elevated] in Solr) - this
is the option "Query handler plugin", or it can be set locally in Drupal based
on the elevated items send to the search back as part of the search query. The
former is not always working as expected in Solr, and in such cases can the
latter option be used.

Developers

The Search API Best Bets modules provides the following ways for developers to
extend the functionality:

Plugins

Best Bets Query Handler plugin - see the annotation and the Solr plugin:

  • Drupal\search_api_best_bets\Annotation\SearchApiBestBetsQueryHandler
  • Drupal\search_api_best_bets\Plugin\search_api_best_bets\query_handler\Solr

Theming

Search API Pages result template (search-api-page-result.html.twig)

  • class search-api-elevated is added to both title and content attributes.
  • variable elevated is TRUE if the item was elevated.

Other templates / theming

  • Get the elevate status from $item->getExtraData('elevated').

Activity

Total releases
3
First release
Apr 2026
Latest release
1 month ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Release date
4.0.0 Stable Jun 17, 2026
3.0.2 Stable Apr 18, 2026
4.0.x-dev Dev Apr 18, 2026