You are here

public static function SuggestionHelper::index in Autocomplete Search Suggestions 7

Create a suggestion index from content titles.

Parameters

int $last_nid: The last node ID processed.

int $limit: The query limit.

3 calls to SuggestionHelper::index()
drush_suggestion_index in ./suggestion.drush.inc
Index suggestions.
suggestion_cron in ./suggestion.module
Implements hook_cron().
suggestion_index_block_ajax_callback in ./suggestion.module
Drupal AJAX callback form for the "Index Suggestions" block.

File

src/SuggestionHelper.php, line 128
Helper methods for the suggestion module.

Class

SuggestionHelper
Provides helper methods for suggestions.

Code

public static function index($last_nid = 0, $limit = NULL) {
  $count =& drupal_static(__CLASS__ . '_' . __FUNCTION__ . '_count', 0);
  $nid =& drupal_static(__CLASS__ . '_' . __FUNCTION__ . '_nid', 0);
  variable_set('suggestion_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);
  }
}