You are here

public static function Utility::formatBoostFactor in Search API 8

Formats a boost factor as a standard float value.

Parameters

string|float $boost_factor: The boost factor to be formatted.

Return value

string The formatted boost factor (with two decimal places).

12 calls to Utility::formatBoostFactor()
IndexFieldsForm::buildFieldsTable in src/Form/IndexFieldsForm.php
Builds the form fields for a set of fields.
IntegrationTest::addFieldsToIndex in tests/src/Functional/IntegrationTest.php
Tests whether adding fields to the index works correctly.
IntegrationTest::changeProcessorFieldBoost in tests/src/Functional/IntegrationTest.php
Tests that a field added by a processor can be changed.
NumberFieldBoost::buildConfigurationForm in src/Plugin/search_api/processor/NumberFieldBoost.php
Form constructor.
NumberFieldBoost::submitConfigurationForm in src/Plugin/search_api/processor/NumberFieldBoost.php
Form submission handler.

... See full list

File

src/Utility/Utility.php, line 328

Class

Utility
Contains utility methods for the Search API.

Namespace

Drupal\search_api\Utility

Code

public static function formatBoostFactor($boost_factor) : string {
  return sprintf('%.2F', $boost_factor ?? 0);
}