當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FinderIndexer::tokenizeToDB方法代碼示例

本文整理匯總了PHP中FinderIndexer::tokenizeToDB方法的典型用法代碼示例。如果您正苦於以下問題:PHP FinderIndexer::tokenizeToDB方法的具體用法?PHP FinderIndexer::tokenizeToDB怎麽用?PHP FinderIndexer::tokenizeToDB使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FinderIndexer的用法示例。


在下文中一共展示了FinderIndexer::tokenizeToDB方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index


//.........這裏部分代碼省略.........
     }
     // Truncate the tokens aggregate table.
     $db->truncateTable('#__finder_tokens_aggregate');
     // Check for a database error.
     if ($db->getErrorNum()) {
         // Throw database error exception.
         throw new Exception($db->getErrorMsg(), 500);
     }
     /*
      * Process the item's content. The items can customize their
      * processing instructions to define extra properties to process
      * or rearrange how properties are weighted.
      */
     foreach ($item->getInstructions() as $group => $properties) {
         // Iterate through the properties of the group.
         foreach ($properties as $property) {
             // Check if the property exists in the item.
             if (empty($item->{$property})) {
                 continue;
             }
             // Tokenize the property.
             if (is_array($item->{$property})) {
                 // Tokenize an array of content and add it to the database.
                 foreach ($item->{$property} as $ip) {
                     // If the group is path, we need to a few extra processing
                     // steps to strip the extension and convert slashes and dashes
                     // to spaces.
                     if ($group === self::PATH_CONTEXT) {
                         $ip = JFile::stripExt($ip);
                         $ip = str_replace('/', ' ', $ip);
                         $ip = str_replace('-', ' ', $ip);
                     }
                     // Tokenize a string of content and add it to the database.
                     $count += FinderIndexer::tokenizeToDB($ip, $group, $item->language, $format);
                     // Check if we're approaching the memory limit of the token table.
                     if ($count > self::$state->options->get('memory_table_limit', 30000)) {
                         FinderIndexer::toggleTables(false);
                     }
                 }
             } else {
                 // If the group is path, we need to a few extra processing
                 // steps to strip the extension and convert slashes and dashes
                 // to spaces.
                 if ($group === self::PATH_CONTEXT) {
                     $item->{$property} = JFile::stripExt($item->{$property});
                     $item->{$property} = str_replace('/', ' ', $item->{$property});
                     $item->{$property} = str_replace('-', ' ', $item->{$property});
                 }
                 // Tokenize a string of content and add it to the database.
                 $count += FinderIndexer::tokenizeToDB($item->{$property}, $group, $item->language, $format);
                 // Check if we're approaching the memory limit of the token table.
                 if ($count > self::$state->options->get('memory_table_limit', 30000)) {
                     FinderIndexer::toggleTables(false);
                 }
             }
         }
     }
     /*
      * Process the item's taxonomy. The items can customize their
      * taxonomy mappings to define extra properties to map.
      */
     foreach ($item->getTaxonomy() as $branch => $nodes) {
         // Iterate through the nodes and map them to the branch.
         foreach ($nodes as $node) {
             // Add the node to the tree.
             $nodeId = FinderIndexerTaxonomy::addNode($branch, $node->title, $node->state, $node->access);
開發者ID:acculitx,項目名稱:fleetmatrixsite,代碼行數:67,代碼來源:indexer.php


注:本文中的FinderIndexer::tokenizeToDB方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。