Exemple #1
0
 public static function BuildSearchIndex($site, $page, $root = '../')
 {
     // get content from published fragment
     $content = '';
     $fragment = $root . 'sites/' . $site['FriendlyId'] . '/fragments/publish/' . $page['PageUniqId'] . '.html';
     if (file_exists($fragment)) {
         $content = file_get_contents($fragment);
     }
     // remove existing index
     SearchIndex::Remove($page['PageUniqId']);
     // build the search index for the page in the default language
     $isDefaultLanguage = true;
     Utilities::BuildSearchIndex($site, $page, $site['Language'], $isDefaultLanguage, $content, $root);
     // get a list of other languages
     $rootPrefix = $root . 'sites/' . $site['FriendlyId'] . '/';
     // build index for non-default languages
     $languages = Utilities::GetSupportedLanguages($rootPrefix);
     $isDefaultLanguage = false;
     foreach ($languages as $language) {
         if ($language != $site['Language']) {
             Utilities::BuildSearchIndex($site, $page, $language, $isDefaultLanguage, $content, $root);
         }
     }
 }