public static function SuggestionHelper::updateSrc in Autocomplete Search Suggestions 7
Calculate the ngram's density.
Parameters
string $ngram: The ngram to update.
int $src: The ngram source.
Return value
object A Merge object.
1 call to SuggestionHelper::updateSrc()
- suggestion_admin_search_form_update_submit in ./
suggestion.admin.inc - Ngram update submission function.
File
- src/
SuggestionHelper.php, line 316 - Helper methods for the suggestion module.
Class
- SuggestionHelper
- Provides helper methods for suggestions.
Code
public static function updateSrc($ngram = '', $src = 0) {
$obj = SuggestionStorage::getSuggestion($ngram);
$key = array(
'ngram' => $ngram,
);
$fields = array(
'atoms' => $obj->atoms,
'density' => self::calculateDensity($src, $obj->atoms, $obj->qty),
'qty' => $obj->qty,
'src' => $src,
);
return SuggestionStorage::mergeSuggestion($key, $fields);
}