public static function SuggestionStorage::getBitmap in Autocomplete Search Suggestions 8.2
Same name and namespace in other branches
- 8 src/SuggestionStorage.php \Drupal\suggestion\SuggestionStorage::getBitmap()
- 3.0.x src/SuggestionStorage.php \Drupal\suggestion\SuggestionStorage::getBitmap()
Calculate the suggestion's bitmap.
Parameters
string $ngram: The text to index.
int $src: The bits to OR with the current bitmap.
string $langcode: The language code.
Return value
int The new bitmap value.
2 calls to SuggestionStorage::getBitmap()
- SuggestionHelper::insert in src/
SuggestionHelper.php - Add a suggestion.
- suggestion_surfer_submit in ./
suggestion.module - Custom submit function to add surfer suggestions.
File
- src/
SuggestionStorage.php, line 99
Class
- SuggestionStorage
- Database CRUD.
Namespace
Drupal\suggestionCode
public static function getBitmap($ngram = '', $src = self::CONTENT_BIT, $langcode = '') {
$args = [
':langcode' => $langcode,
':ngram' => $ngram,
':src' => (int) $src,
];
return \Drupal::database()
->query("SELECT IFNULL(SUM(src), 0) | :src FROM {suggestion} WHERE ngram = :ngram AND langcode = :langcode", $args)
->fetchField();
}