当前位置: 首页>>代码示例>>PHP>>正文


PHP eZSearch::getEngine方法代码示例

本文整理汇总了PHP中eZSearch::getEngine方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSearch::getEngine方法的具体用法?PHP eZSearch::getEngine怎么用?PHP eZSearch::getEngine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZSearch的用法示例。


在下文中一共展示了eZSearch::getEngine方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build

 public static function build(\Closure $legacyKernelClosure)
 {
     try {
         $searchEngine = $legacyKernelClosure()->runCallback(function () {
             return \eZSearch::getEngine();
         });
     } catch (\Exception $e) {
         $searchEngine = new NullSearchEngine();
     }
     return $searchEngine;
 }
开发者ID:sdaoudi,项目名称:EzSystemsRecommendationBundle,代码行数:11,代码来源:LegacySearchFactory.php

示例2: swapNode

    /**
     * Notifies search engine about an swap node operation
     *
     * @since 4.1
     * @param int $nodeID
     * @param int $selectedNodeID
     * @param array $nodeIdList
     * @return false|mixed False in case method is undefined, otherwise return the result of the search engine call
     */
    public static function swapNode( $nodeID, $selectedNodeID, $nodeIdList = array() )
    {
        $searchEngine = eZSearch::getEngine();

        if ( $searchEngine instanceof ezpSearchEngine && method_exists( $searchEngine, 'swapNode' ) )
        {
            return $searchEngine->swapNode( $nodeID, $selectedNodeID, $nodeIdList = array() );
        }

        return false;
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:20,代码来源:ezsearch.php

示例3: updateAlwaysAvailable

 /**
  * Set the always available flag for a content object
  *
  * @param int $objectID
  * @param int $newAlwaysAvailable
  * @return array An array with operation status, always true
  */
 public static function updateAlwaysAvailable($objectID, $newAlwaysAvailable)
 {
     $object = eZContentObject::fetch($objectID);
     $change = false;
     if ($object->isAlwaysAvailable() & $newAlwaysAvailable == false) {
         $object->setAlwaysAvailableLanguageID(false);
         $change = true;
     } else {
         if (!$object->isAlwaysAvailable() & $newAlwaysAvailable == true) {
             $object->setAlwaysAvailableLanguageID($object->attribute('initial_language_id'));
             $change = true;
         }
     }
     if ($change) {
         eZContentCacheManager::clearContentCacheIfNeeded($objectID);
         if (!eZSearch::getEngine() instanceof eZSearchEngine) {
             eZContentOperationCollection::registerSearchObject($objectID);
         }
     }
     return array('status' => true);
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:28,代码来源:ezcontentoperationcollection.php

示例4: alignArticle

/**
 * Aligns articles published under given publisher folder
 * @param eZContentObject $publisherObject
 */
function alignArticle( $publisherObject, $checkModified = false, $checkLocations = false, $checkLanguages = false, $checkHidden = false, $timingDelay = 0, $forceLast = 0, $sleepTime = 1 )
{
	echo "Starting treatment of publisher folder : " . $publisherObject->name() . "\n";
	echo "Fetching solr informations\n";
	$eZSolr        = eZSearch::getEngine();
	$offset        = 0;
    $forced        = 0;
	$limit         = 200;
	$publisherNode = $publisherObject->mainNode();
	$doCheck       = $checkModified || $checkLocations || $checkLanguages || $checkHidden;
	$solrInfos     = fetchSolrPublisherFolder ( $publisherNode, $checkModified, $checkLocations, $checkLanguages, $checkHidden, $sleepTime );
	
	echo "Solr count : " . count($solrInfos) . "\n";

	while ( true )
	{
		$params = array(
				'Offset'           => $offset,
				'Limit'            => $limit,
				'ClassFilterType'  => 'include',
				'ClassFilterArray' => array( 'article' ),
				'LoadDataMap'      => false,
				'AsObject'         => false,
				'MainNodeOnly'     => true,
		);
        
        if ($forceLast > 0)
            $params['SortBy'] = array ( array('published', false ) );

		$nodeList = $publisherNode->subtree( $params );
		echo "\neZ Offset : $offset\n";

		if ( count( $nodeList ) == 0 )
		{
			break;
		}
	
		foreach ( $nodeList as $mainNode )
		{
			$nodeId = $mainNode['node_id'];
			$objectId = $mainNode['contentobject_id'];
			$toUpdate = false;

            if ( $forceLast > 0 && $forced < $forceLast )
                $toUpdate = true;
			elseif ( isset($solrInfos[$nodeId]) )
			{
				if ( $doCheck )
				{
					if ( $checkLanguages )
					{
						$eZLanguages = eZContentObject::fetch($objectId)->languages();
						$toUpdate = compareLanguages( array_keys($eZLanguages), $solrInfos[$nodeId]['languages'] );
						
						showInvalidTranslations(array_keys($eZLanguages), $solrInfos[$nodeId]['languages'], $objectId);
					}

					if (!$toUpdate && $checkModified)
						$toUpdate = compareDates($mainNode['modified'], $solrInfos[$nodeId]['modified'], $timingDelay);

					if (!$toUpdate && $checkLocations)
						$toUpdate = compareLocations($objectId, $solrInfos[$nodeId]['locations']);

                    if (!$toUpdate && $checkHidden)
                        $toUpdate = compareHidden($objectId, $solrInfos[$nodeId]['hiddenCount'], $solrInfos[$nodeId]['notHiddenCount']);
				}

				unset($solrInfos[$nodeId]);
			}
			else
				$toUpdate = true;

			if ( $toUpdate )
			{
				$return = $eZSolr->addObject( eZContentObject::fetch($objectId), false );

				echo ( !$return ? '!' . $objectId . '!' : '+' );
			}
			else
				echo '-';
            
            $forced++;
		}
	
		$offset += $limit;

		eZContentObject::clearCache();
        
        if ( $sleepTime > 0 )
            sleep ($sleepTime);
	}
	
	echo "\nArticles in solr but unknown from eZPublish : " . count($solrInfos) . " articles\n";
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:98,代码来源:align_solr.php

示例5:

<?php

/**
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
 * @license For full copyright and license information view LICENSE file distributed with this source code.
 * @version 2014.07.0
 */
if (!$isQuiet) {
    $cli->output("Starting solr index optimization");
}
// check that solr is enabled and used
$eZSolr = eZSearch::getEngine();
if (!$eZSolr instanceof eZSolr) {
    $script->shutdown(1, 'The current search engine plugin is not eZSolr');
}
$eZSolr->optimize(false);
if (!$isQuiet) {
    $cli->output("Done");
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:19,代码来源:ezfoptimizeindex.php

示例6: removeNodes

 /**
  * Removes nodes
  *
  * This function does not check about permissions, this is the responsibility of the caller!
  *
  * @param array $removeNodeIdList Array of Node ID to remove
  *
  * @return array An array with operation status, always true
  */
 public static function removeNodes(array $removeNodeIdList)
 {
     $mainNodeChanged = array();
     $nodeAssignmentIdList = array();
     $objectIdList = array();
     $db = eZDB::instance();
     $db->begin();
     foreach ($removeNodeIdList as $nodeId) {
         $node = eZContentObjectTreeNode::fetch($nodeId);
         $objectId = $node->attribute('contentobject_id');
         foreach (eZNodeAssignment::fetchForObject($objectId, eZContentObject::fetch($objectId)->attribute('current_version'), 0, false) as $nodeAssignmentKey => $nodeAssignment) {
             if ($nodeAssignment['parent_node'] == $node->attribute('parent_node_id')) {
                 $nodeAssignmentIdList[$nodeAssignment['id']] = 1;
             }
         }
         if ($nodeId == $node->attribute('main_node_id')) {
             $mainNodeChanged[$objectId] = 1;
         }
         $node->removeThis();
         if (!isset($objectIdList[$objectId])) {
             $objectIdList[$objectId] = eZContentObject::fetch($objectId);
         }
     }
     // Give other search engines that the default one a chance to reindex
     // when removing locations.
     if (!eZSearch::getEngine() instanceof eZSearchEngine) {
         foreach ($objectIdList as $objectId => $object) {
             eZContentOperationCollection::registerSearchObject($objectId, $object->attribute('current_version'));
         }
     }
     eZNodeAssignment::purgeByID(array_keys($nodeAssignmentIdList));
     foreach (array_keys($mainNodeChanged) as $objectId) {
         $allNodes = $objectIdList[$objectId]->assignedNodes();
         // Registering node that will be promoted as 'main'
         $mainNodeChanged[$objectId] = $allNodes[0];
         eZContentObjectTreeNode::updateMainNodeID($allNodes[0]->attribute('node_id'), $objectId, false, $allNodes[0]->attribute('parent_node_id'));
     }
     $db->commit();
     //call appropriate method from search engine
     eZSearch::removeNodes($removeNodeIdList);
     $userClassIdList = eZUser::contentClassIDs();
     foreach ($objectIdList as $objectId => $object) {
         eZContentCacheManager::clearObjectViewCacheIfNeeded($objectId);
         // clear user policy cache if this was a user object
         if (in_array($object->attribute('contentclass_id'), $userClassIdList)) {
             eZUser::purgeUserCacheByUserId($object->attribute('id'));
         }
     }
     // we don't clear template block cache here since it's cleared in eZContentObjectTreeNode::removeNode()
     return array('status' => true);
 }
开发者ID:rmiguel,项目名称:ezpublish,代码行数:60,代码来源:ezcontentoperationcollection.php


注:本文中的eZSearch::getEngine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。