Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Search API Best Bets

Security covered Maintenance fixes only 817 sites

Part of the Search ecosystem · 125 projects

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

Ask your assistant about Search API Best Bets

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

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
7
Tracked since
Oct 2023
Latest release
3 months ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP 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
3.0.1 Stable 10–11 PHP >=8.1.0 Jul 8, 2024
3.0.0 Stable 10–11 PHP >=8.1.0 Jun 10, 2024
3.0.x-dev Dev 10–11 PHP >=8.1.0 Mar 6, 2024
2.0.3 Stable 9–10 Oct 11, 2023