Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Search API Best Bets

750 sites Security covered Drupal 11 · not 10
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').

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Apr 2026
Latest release
2 months ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

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