public static function SuggestionHelper::index in Autocomplete Search Suggestions 8
Same name and namespace in other branches
- 8.2 src/SuggestionHelper.php \Drupal\suggestion\SuggestionHelper::index()
- 3.0.x src/SuggestionHelper.php \Drupal\suggestion\SuggestionHelper::index()
Create a suggestion index from content titles.
Parameters
int $last_nid: The last node ID processed.
int $limit: The query limit.
2 calls to SuggestionHelper::index()
- SuggestionIndexForm::submitForm in src/
Form/ SuggestionIndexForm.php - AJAX callback for the indexing form.
- suggestion_cron in ./
suggestion.module - Implements hook_cron().
File
- src/
SuggestionHelper.php, line 134
Class
- SuggestionHelper
- Provides helper methods for suggestions.
Namespace
Drupal\suggestionCode
public static function index($last_nid = 0, $limit = NULL) {
$count =& drupal_static(__CLASS__ . '_' . __FUNCTION__ . '_count', 0);
$nid =& drupal_static(__CLASS__ . '_' . __FUNCTION__ . '_nid', 0);
self::setConfig('synced', TRUE);
if (!$last_nid) {
SuggestionStorage::deleteContentSuggestion();
SuggestionStorage::updateContentSrc();
}
$titles = SuggestionStorage::getTitles($last_nid, $limit);
foreach ($titles as $nid => $title) {
$count += self::insert($title, SuggestionStorage::CONTENT_BIT);
}
}