You are here

public function GenericDatabase::preprocessIndexValue in Search API 8

Determines the canonical base form of a value.

For example, when the table is case-insensitive, the value should always be lowercased (or always uppercased) to arrive at the canonical base form.

If tables of the given type use binary comparison in this database, the value should not be changed.

Parameters

string $value: A string to be indexed or searched for.

string $type: (optional) The type of table. One of "index" (for the denormalized table for an entire index), "text" (for an index's fulltext data table) and "field" (for field-specific tables).

Return value

string The value in its canonical base form, which won't clash with any other canonical base form when inserted into a table of the given type.

Overrides DatabaseCompatibilityHandlerInterface::preprocessIndexValue

1 call to GenericDatabase::preprocessIndexValue()
MySql::preprocessIndexValue in modules/search_api_db/src/DatabaseCompatibility/MySql.php
Determines the canonical base form of a value.
2 methods override GenericDatabase::preprocessIndexValue()
CaseSensitiveDatabase::preprocessIndexValue in modules/search_api_db/src/DatabaseCompatibility/CaseSensitiveDatabase.php
Determines the canonical base form of a value.
MySql::preprocessIndexValue in modules/search_api_db/src/DatabaseCompatibility/MySql.php
Determines the canonical base form of a value.

File

modules/search_api_db/src/DatabaseCompatibility/GenericDatabase.php, line 65

Class

GenericDatabase
Represents any database for which no specifics are known.

Namespace

Drupal\search_api_db\DatabaseCompatibility

Code

public function preprocessIndexValue($value, $type = 'text') {
  if ($type == 'text') {
    return $value;
  }
  return mb_strtolower($this->transliterator
    ->transliterate($value));
}