You are here

public static function SuggestionStorage::getBitmap in Autocomplete Search Suggestions 7

Calculate the suggestion's bitmap.

Parameters

string $ngram: The text to index.

int $src: The bits to OR with the current bitmap.

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 94
CRUD methods for the suggestion module.

Class

SuggestionStorage
Database CRUD.

Code

public static function getBitmap($ngram = '', $src = self::CONTENT_BIT) {
  $args = array(
    ':ngram' => $ngram,
    ':src' => (int) $src,
  );
  return db_query("SELECT IFNULL(SUM(src), 0) | :src FROM {suggestion} WHERE ngram = :ngram", $args)
    ->fetchField();
}