Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). leaflet 10.4.5 Minor update available for module leaflet (10.4.5). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2).

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
2
First release
Apr 2026
Latest release
19 hours ago
Release cadence
0 days
Stability
50% stable

Releases

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