本文整理汇总了PHP中eZSearch类 的典型用法代码示例。如果您正苦于以下问题:PHP eZSearch类的具体用法?PHP eZSearch怎么用?PHP eZSearch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZSearch类 的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: fetchContentSearch
public static function fetchContentSearch($searchText, $subTreeArray, $offset, $limit, $searchTimestamp, $publishDate, $sectionID, $classID, $classAttributeID, $ignoreVisibility, $limitation, $sortArray)
{
$searchArray = eZSearch::buildSearchArray();
$parameters = array();
if ($classID !== false) {
$parameters['SearchContentClassID'] = $classID;
}
if ($classAttributeID !== false) {
$parameters['SearchContentClassAttributeID'] = $classAttributeID;
}
if ($sectionID !== false) {
$parameters['SearchSectionID'] = $sectionID;
}
if ($publishDate !== false) {
$parameters['SearchDate'] = $publishDate;
}
if ($sortArray !== false) {
$parameters['SortArray'] = $sortArray;
}
$parameters['SearchLimit'] = $limit;
$parameters['SearchOffset'] = $offset;
$parameters['IgnoreVisibility'] = $ignoreVisibility;
$parameters['Limitation'] = $limitation;
if ($subTreeArray !== false) {
$parameters['SearchSubTreeArray'] = $subTreeArray;
}
if ($searchTimestamp) {
$parameters['SearchTimestamp'] = $searchTimestamp;
}
$searchResult = eZSearch::search($searchText, $parameters, $searchArray);
return array('result' => $searchResult);
}
开发者ID:CG77, 项目名称:ezpublish-legacy, 代码行数:32, 代码来源:ezcontentfunctioncollection.php
示例3: search
/**
* Returns search results based on given post params
*
* @param mixed $args Only used if post parameter is not set
* 0 => SearchStr
* 1 => SearchOffset
* 2 => SearchLimit (10 by default, max 50)
* @return array
*/
public static function search($args)
{
$http = eZHTTPTool::instance();
if ($http->hasPostVariable('SearchStr')) {
$searchStr = trim($http->postVariable('SearchStr'));
} else {
if (isset($args[0])) {
$searchStr = trim($args[0]);
}
}
if ($http->hasPostVariable('SearchOffset')) {
$searchOffset = (int) $http->postVariable('SearchOffset');
} else {
if (isset($args[1])) {
$searchOffset = (int) $args[1];
} else {
$searchOffset = 0;
}
}
if ($http->hasPostVariable('SearchLimit')) {
$searchLimit = (int) $http->postVariable('SearchLimit');
} else {
if (isset($args[2])) {
$searchLimit = (int) $args[2];
} else {
$searchLimit = 10;
}
}
// Do not allow to search for more then x items at a time
$ini = eZINI::instance();
$maximumSearchLimit = (int) $ini->variable('SearchSettings', 'MaximumSearchLimit');
if ($searchLimit > $maximumSearchLimit) {
$searchLimit = $maximumSearchLimit;
}
// Prepare node encoding parameters
$encodeParams = array();
if (self::hasPostValue($http, 'EncodingLoadImages')) {
$encodeParams['loadImages'] = true;
}
if (self::hasPostValue($http, 'EncodingFetchChildrenCount')) {
$encodeParams['fetchChildrenCount'] = true;
}
if (self::hasPostValue($http, 'EncodingFetchSection')) {
$encodeParams['fetchSection'] = true;
}
if (self::hasPostValue($http, 'EncodingFormatDate')) {
$encodeParams['formatDate'] = $http->postVariable('EncodingFormatDate');
}
// Prepare search parameters
$params = array('SearchOffset' => $searchOffset, 'SearchLimit' => $searchLimit, 'SortArray' => array('published', 0), 'SortBy' => array('published' => 'desc'));
if (self::hasPostValue($http, 'SearchContentClassAttributeID')) {
$params['SearchContentClassAttributeID'] = self::makePostArray($http, 'SearchContentClassAttributeID');
} else {
if (self::hasPostValue($http, 'SearchContentClassID')) {
$params['SearchContentClassID'] = self::makePostArray($http, 'SearchContentClassID');
} else {
if (self::hasPostValue($http, 'SearchContentClassIdentifier')) {
$params['SearchContentClassID'] = eZContentClass::classIDByIdentifier(self::makePostArray($http, 'SearchContentClassIdentifier'));
}
}
}
if (self::hasPostValue($http, 'SearchSubTreeArray')) {
$params['SearchSubTreeArray'] = self::makePostArray($http, 'SearchSubTreeArray');
}
if (self::hasPostValue($http, 'SearchSectionID')) {
$params['SearchSectionID'] = self::makePostArray($http, 'SearchSectionID');
}
if (self::hasPostValue($http, 'SearchDate')) {
$params['SearchDate'] = (int) $http->postVariable('SearchDate');
} else {
if (self::hasPostValue($http, 'SearchTimestamp')) {
$params['SearchTimestamp'] = self::makePostArray($http, 'SearchTimestamp');
if (!isset($params['SearchTimestamp'][1])) {
$params['SearchTimestamp'] = $params['SearchTimestamp'][0];
}
}
}
if (self::hasPostValue($http, 'EnableSpellCheck') || self::hasPostValue($http, 'enable-spellcheck', '0')) {
$params['SpellCheck'] = array(true);
}
if (self::hasPostValue($http, 'GetFacets') || self::hasPostValue($http, 'show-facets', '0')) {
$params['facet'] = eZFunctionHandler::execute('ezfind', 'getDefaultSearchFacets', array());
}
$result = array('SearchOffset' => $searchOffset, 'SearchLimit' => $searchLimit, 'SearchResultCount' => 0, 'SearchCount' => 0, 'SearchResult' => array(), 'SearchString' => $searchStr, 'SearchExtras' => array());
// Possibility to keep track of callback reference for use in js callback function
if ($http->hasPostVariable('CallbackID')) {
$result['CallbackID'] = $http->postVariable('CallbackID');
}
// Only search if there is something to search for
if ($searchStr) {
$searchList = eZSearch::search($searchStr, $params);
//.........这里部分代码省略.........
开发者ID:legende91, 项目名称:ez, 代码行数:101, 代码来源:ezjscserverfunctionsjs.php
示例4: removeNodeFromTree
function removeNodeFromTree($moveToTrash = true)
{
$nodeID = $this->attribute('node_id');
$object = $this->object();
$assignedNodes = $object->attribute('assigned_nodes');
if ($nodeID == $this->attribute('main_node_id')) {
if (count($assignedNodes) > 1) {
$newMainNode = false;
foreach ($assignedNodes as $assignedNode) {
$assignedNodeID = $assignedNode->attribute('node_id');
if ($assignedNodeID == $nodeID) {
continue;
}
$newMainNode = $assignedNode;
break;
}
// We need to change the main node ID before we remove the current node
$db = eZDB::instance();
$db->begin();
eZContentObjectTreeNode::updateMainNodeID($newMainNode->attribute('node_id'), $object->attribute('id'), $object->attribute('current_version'), $newMainNode->attribute('parent_node_id'));
$this->removeThis();
eZSearch::addObject($object);
$db->commit();
} else {
// This is the last assignment so we remove the object too
$db = eZDB::instance();
$db->begin();
$this->removeThis();
if ($moveToTrash) {
// saving information about this node in ..trash_node table
$trashNode = eZContentObjectTrashNode::createFromNode($this);
$db = eZDB::instance();
$db->begin();
$trashNode->storeToTrash();
$db->commit();
$object->removeThis();
} else {
$object->purge();
}
$db->commit();
}
} else {
$this->removeThis();
if (count($assignedNodes) > 1) {
eZSearch::addObject($object);
}
}
}
开发者ID:brookinsconsulting, 项目名称:ezecosystem, 代码行数:48, 代码来源:ezcontentobjecttreenode.php
示例5: removeThis
/**
* Archives the current object and removes assigned nodes
*
* Transaction unsafe. If you call several transaction unsafe methods you must enclose
* the calls within a db transaction; thus within db->begin and db->commit.
*
* @param int $nodeID
*/
function removeThis( $nodeID = null )
{
$delID = $this->ID;
// Who deletes which content should be logged.
eZAudit::writeAudit( 'content-delete', array( 'Object ID' => $delID, 'Content Name' => $this->attribute( 'name' ),
'Comment' => 'Setted archived status for the current object: eZContentObject::remove()' ) );
$nodes = $this->attribute( 'assigned_nodes' );
if ( $nodeID === null or count( $nodes ) <= 1 )
{
$db = eZDB::instance();
$db->begin();
$mainNodeKey = false;
foreach ( $nodes as $key => $node )
{
if ( $node->attribute( 'main_node_id' ) == $node->attribute( 'node_id' ) )
{
$mainNodeKey = $key;
}
else
{
$node->removeThis();
}
}
if ( $mainNodeKey !== false )
{
$nodes[$mainNodeKey]->removeNodeFromTree( true );
}
$this->setAttribute( 'status', eZContentObject::STATUS_ARCHIVED );
eZSearch::removeObjectById( $delID );
$this->store();
eZContentObject::fixReverseRelations( $delID, 'trash' );
// Delete stored attribute from other tables
$db->commit();
}
else if ( $nodeID !== null )
{
$node = eZContentObjectTreeNode::fetch( $nodeID , false );
if ( is_object( $node ) )
{
if ( $node->attribute( 'main_node_id' ) == $nodeID )
{
$db = eZDB::instance();
$db->begin();
foreach ( $additionalNodes as $additionalNode )
{
if ( $additionalNode->attribute( 'node_id' ) != $node->attribute( 'main_node_id' ) )
{
$additionalNode->remove();
}
}
$node->removeNodeFromTree( true );
$this->setAttribute( 'status', eZContentObject::STATUS_ARCHIVED );
eZSearch::removeObjectById( $delID );
$this->store();
eZContentObject::fixReverseRelations( $delID, 'trash' );
$db->commit();
}
else
{
eZContentObjectTreeNode::removeNode( $nodeID );
}
}
}
else
{
eZContentObjectTreeNode::removeNode( $nodeID );
}
}
开发者ID:ezsystemstraining, 项目名称:ez54training, 代码行数:84, 代码来源:ezcontentobject.php
示例6: QuestionInteractiveCli
}
$pathIdentificationString = $node->attribute('path_identification_string');
if ( $node->IsHidden )
{
$cli->warning ( " Already hidden : [" . $nodeId . "] " . $pathIdentificationString . " : " . $node->getName() );
continue;
}
$validCalculatorsNodeId[] = $nodeId;
$possibleReplies[] = $nodeId . " " . $pathIdentificationString . " : " . $node->getName();
}
$questionHandler = new QuestionInteractiveCli();
$question = "Hide which nodes";
$response = $questionHandler->askQuestionMultipleChoices($question, $possibleReplies, 'validateReplyMultiple', true);
foreach ( $response as $indexToHide )
{
$nodeId = $validCalculatorsNodeId[$indexToHide];
$node = eZContentObjectTreeNode::fetch($nodeId);
eZContentObjectTreeNode::hideSubTree( $node );
eZSearch::updateNodeVisibility( $node->NodeID, 'hide' );
$pathIdentificationString = $node->attribute('path_identification_string');
$cli->warning ( " Hiding : [" . $nodeId . "] " . $pathIdentificationString . " : " . $node->getName() );
}
开发者ID:sushilbshinde, 项目名称:ezpublish-study, 代码行数:30, 代码来源:hide_calculators.php
示例7: array
} else {
$subTreeList = array($http->variable('SubTreeArray'));
}
foreach ($subTreeList as $subTreeItem) {
// as form input is generally a string, is_int cannot be used for checking the value type
if (is_numeric($subTreeItem) && $subTreeItem > 0) {
$subTreeArray[] = $subTreeItem;
}
}
}
$Module->setTitle("Search for: {$searchText}");
$classArray = eZContentClass::fetchList(eZContentClass::VERSION_STATUS_DEFINED, true, false, array('name' => 'asc'));
$sectionArray = eZSection::fetchList();
$searchArray = eZSearch::buildSearchArray();
if ($useSearchCode) {
$searchResult = eZSearch::search($searchText, array('SearchSectionID' => $searchSectionID, 'SearchContentClassID' => $searchContentClassID, 'SearchContentClassAttributeID' => $searchContentClassAttributeID, 'SearchSubTreeArray' => $subTreeArray, 'SearchDate' => $searchDate, 'SearchTimestamp' => $searchTimestamp, 'SearchLimit' => $pageLimit, 'SearchOffset' => $Offset), $searchArray);
if (strlen(trim($searchText)) == 0 && count($searchArray) > 0) {
$searchText = 'search by additional parameter';
}
}
$viewParameters = array('offset' => $Offset);
$searchData = false;
$tpl->setVariable("search_data", $searchData);
$tpl->setVariable('search_contentclass_id', $searchContentClassID);
$tpl->setVariable('search_contentclass_attribute_id', $searchContentClassAttributeID);
$tpl->setVariable('search_section_id', $searchSectionID);
$tpl->setVariable('search_date', $searchDate);
$tpl->setVariable('search_timestamp', $searchTimestamp);
$tpl->setVariable('search_sub_tree', $subTreeArray);
$tpl->setVariable('search_text', $searchText);
$tpl->setVariable('search_page_limit', $searchPageLimit);
开发者ID:mugoweb, 项目名称:ezpublish-legacy, 代码行数:31, 代码来源:advancedsearch.php
示例8:
<?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
示例9: move
static function move($nodeID, $newParentNodeID)
{
$result = false;
if (!is_numeric($nodeID) || !is_numeric($newParentNodeID)) {
return false;
}
$node = eZContentObjectTreeNode::fetch($nodeID);
if (!$node) {
return false;
}
$object = $node->object();
if (!$object) {
return false;
}
$objectID = $object->attribute('id');
$oldParentNode = $node->fetchParent();
$oldParentObject = $oldParentNode->object();
// clear user policy cache if this is a user object
if (in_array($object->attribute('contentclass_id'), eZUser::contentClassIDs())) {
eZUser::purgeUserCacheByUserId($object->attribute('id'));
}
// clear cache for old placement.
// If child count exceeds threshold, do nothing here, and instead clear all view cache at the end.
$childCountInThresholdRange = eZContentCache::inCleanupThresholdRange($node->childrenCount(false));
if ($childCountInThresholdRange) {
eZContentCacheManager::clearContentCacheIfNeeded($objectID);
}
$db = eZDB::instance();
$db->begin();
$node->move($newParentNodeID);
$newNode = eZContentObjectTreeNode::fetchNode($objectID, $newParentNodeID);
if ($newNode) {
$newNode->updateSubTreePath(true, true);
if ($newNode->attribute('main_node_id') == $newNode->attribute('node_id')) {
// If the main node is moved we need to check if the section ID must change
$newParentNode = $newNode->fetchParent();
$newParentObject = $newParentNode->object();
if ($object->attribute('section_id') != $newParentObject->attribute('section_id')) {
eZContentObjectTreeNode::assignSectionToSubTree($newNode->attribute('main_node_id'), $newParentObject->attribute('section_id'), $oldParentObject->attribute('section_id'));
}
}
// modify assignment
$curVersion = $object->attribute('current_version');
$nodeAssignment = eZNodeAssignment::fetch($objectID, $curVersion, $oldParentNode->attribute('node_id'));
if ($nodeAssignment) {
$nodeAssignment->setAttribute('parent_node', $newParentNodeID);
$nodeAssignment->setAttribute('op_code', eZNodeAssignment::OP_CODE_MOVE);
$nodeAssignment->store();
// update search index specifying we are doing a move operation
$nodeIDList = array($nodeID);
eZSearch::removeNodeAssignment($node->attribute('main_node_id'), $newNode->attribute('main_node_id'), $object->attribute('id'), $nodeIDList);
eZSearch::addNodeAssignment($newNode->attribute('main_node_id'), $object->attribute('id'), $nodeIDList, true);
}
$result = true;
} else {
eZDebug::writeError("Node {$nodeID} was moved to {$newParentNodeID} but fetching the new node failed");
}
$db->commit();
// clear cache for new placement.
// If child count exceeds threshold, clear all view cache instead.
if ($childCountInThresholdRange) {
eZContentCacheManager::clearContentCacheIfNeeded($objectID);
} else {
eZContentCacheManager::clearAllContentCache();
}
return $result;
}
开发者ID:CG77, 项目名称:ezpublish-legacy, 代码行数:67, 代码来源:ezcontentobjecttreenodeoperations.php
示例10: normalizeValue
$newValue = normalizeValue($newValue, $currentValue, $attribute);
if ($newValue != $currentValue) {
if ($createNewVersion) {
$params = array('attributes' => array($attributeIdentifier => $newValue));
$result = eZContentFunctions::updateAndPublishObject($object, $params);
if (!$result) {
$data['status'] = 'error';
$data['message'] = "Error creating new object version";
$data['header'] = "HTTP/1.1 400 Bad Request";
} else {
$data['status'] = 'success';
}
} else {
$attribute->fromString($newValue);
$attribute->store();
eZSearch::addObject($object);
eZContentCacheManager::clearObjectViewCacheIfNeeded($object->attribute('id'));
$data['status'] = 'success';
}
}
} else {
$data['status'] = 'error';
$data['message'] = "Attribute not found";
$data['header'] = "HTTP/1.1 404 Not Found";
}
} else {
$data['status'] = 'error';
$data['message'] = "Attribute not found";
$data['header'] = "HTTP/1.1 404 Not Found";
}
} else {
开发者ID:OpencontentCoop, 项目名称:ocoperatorscollection, 代码行数:31, 代码来源:attribute.php
示例11: eZPendingActions
$nodeID = $module->actionParameter( 'NodeID' );
$languageCode = $module->actionParameter( 'LanguageCode' );
$viewMode = 'full';
if ( !$module->hasActionParameter( 'ViewMode' ) )
{
$viewMode = $module->actionParameter( 'ViewMode' );
}
if ( $module->isCurrentAction( 'IndexObject' )
|| $module->isCurrentAction( 'IndexSubtree' )) {
eZContentOperationCollection::registerSearchObject( $objectID );
}
if ( $module->isCurrentAction( 'IndexSubtree' ) ) {
$pendingAction = new eZPendingActions(
array(
'action' => eZSolr::PENDING_ACTION_INDEX_SUBTREE,
'created' => time(),
'param' => $nodeID
)
);
$pendingAction->store();
}
if ( $module->isCurrentAction( 'RemoveObject' ) ) {
$object = eZContentObject::fetch($objectID);
eZSearch::removeObject($object, true);
}
return $module->redirect( 'content', 'view', array( $viewMode, $nodeID, $languageCode ) );
开发者ID:sushilbshinde, 项目名称:ezpublish-study, 代码行数:31, 代码来源:action.php
示例12: move
static function move( $nodeID, $newParentNodeID )
{
$result = false;
if ( !is_numeric( $nodeID ) || !is_numeric( $newParentNodeID ) )
return false;
$node = eZContentObjectTreeNode::fetch( $nodeID );
if ( !$node )
return false;
$object = $node->object();
if ( !$object )
return false;
$objectID = $object->attribute( 'id' );
$oldParentNode = $node->fetchParent();
$oldParentObject = $oldParentNode->object();
// clear user policy cache if this is a user object
if ( in_array( $object->attribute( 'contentclass_id' ), eZUser::contentClassIDs() ) )
{
eZUser::purgeUserCacheByUserId( $object->attribute( 'id' ) );
}
// clear cache for old placement.
eZContentCacheManager::clearContentCacheIfNeeded( $objectID );
$db = eZDB::instance();
$db->begin();
$node->move( $newParentNodeID );
$newNode = eZContentObjectTreeNode::fetchNode( $objectID, $newParentNodeID );
if ( $newNode )
{
$newNode->updateSubTreePath( true, true );
if ( $newNode->attribute( 'main_node_id' ) == $newNode->attribute( 'node_id' ) )
{
// If the main node is moved we need to check if the section ID must change
$newParentNode = $newNode->fetchParent();
$newParentObject = $newParentNode->object();
if ( $object->attribute( 'section_id' ) != $newParentObject->attribute( 'section_id' ) )
{
eZContentObjectTreeNode::assignSectionToSubTree( $newNode->attribute( 'main_node_id' ),
$newParentObject->attribute( 'section_id' ),
$oldParentObject->attribute( 'section_id' ) );
}
}
// modify assignment
$curVersion = $object->attribute( 'current_version' );
$nodeAssignment = eZNodeAssignment::fetch( $objectID, $curVersion, $oldParentNode->attribute( 'node_id' ) );
if ( $nodeAssignment )
{
$nodeAssignment->setAttribute( 'parent_node', $newParentNodeID );
$nodeAssignment->setAttribute( 'op_code', eZNodeAssignment::OP_CODE_MOVE );
$nodeAssignment->store();
// update search index
$nodeIDList = array( $nodeID );
eZSearch::removeNodeAssignment( $node->attribute( 'main_node_id' ), $newNode->attribute( 'main_node_id' ), $object->attribute( 'id' ), $nodeIDList );
eZSearch::addNodeAssignment( $newNode->attribute( 'main_node_id' ), $object->attribute( 'id' ), $nodeIDList );
}
$result = true;
}
else
{
eZDebug::writeError( "Node $nodeID was moved to $newParentNodeID but fetching the new node failed" );
}
$db->commit();
// clear cache for new placement.
eZContentCacheManager::clearContentCacheIfNeeded( $objectID );
return $result;
}
开发者ID:robinmuilwijk, 项目名称:ezpublish, 代码行数:82, 代码来源:ezcontentobjecttreenodeoperations.php
示例13: updateGlobalLimitation
/**
* @param eZContentObject $contentObject
* @param bool|null $parentIsInvisible Only defined as boolean true|false if we are recursively going in a child
*/
public static function updateGlobalLimitation ( $contentObject, $parentIsInvisible = null )
{
/* @type $contentMainNode eZContentObjectTreeNode */
$db = eZDB::instance();
$contentObjectID = $contentObject->attribute('id');
$contentMainNode = $contentObject->mainNode();
if ( !($contentMainNode instanceof eZContentObjectTreeNode) )
return;
/* @type $dm eZContentObjectAttribute[] */
$contentDepth = $contentMainNode->attribute('depth');
$merckINI = eZINI::instance('merck.ini');
$onlineDateAttribute = $merckINI->variable("ArticleVisibility","OnlineDate");
$offlineDateAttribute = $merckINI->variable("ArticleVisibility","OfflineDate");
$dm = $contentObject->attribute("data_map");
if ( !is_array($dm) )
return;
/* @type $onlineDateContent eZDateTime */
/* @type $offlineDateContent eZDateTime */
$onlineDateContent = $dm[$onlineDateAttribute]->content();
$onlineDate = $onlineDateContent->timeStamp();
$offlineDateContent = $dm[$offlineDateAttribute]->content();
$offlineDate = $offlineDateContent->timeStamp();
$visibility = MMEventManager::visibilityDates($contentObject);
$isInvisible = !$visibility;
// We have a parent article, we check its visibility
if ( !$isInvisible && $parentIsInvisible === null && $contentDepth > 4 )
{
$parentNode = $contentMainNode->fetchParent();
$isInvisible = self::isGloballyLimited( $parentNode->attribute('contentobject_id') );
}
elseif ( !$isInvisible )
{
if ( $parentIsInvisible !== null && $parentIsInvisible === true )
$isInvisible = true;
}
$db->beginQuery();
$visibilityChange = self::updateGlobalLimitationEntry( $contentObjectID, $offlineDate, $onlineDate, $visibility, $isInvisible);
if ( $visibilityChange && $visibility && !$isInvisible )
{
eZSearch::updateNodeVisibility($contentObject->mainNodeID(), 'show');
}
elseif ( $visibilityChange && ( !$visibility || $isInvisible ) )
{
eZSearch::updateNodeVisibility($contentObject->mainNodeID(), 'hide');
}
if ( $visibilityChange )
self::spreadGlobalLimitationChange( $contentMainNode, $isInvisible );
$db->commitQuery();
}
开发者ID:sushilbshinde, 项目名称:ezpublish-study, 代码行数:63, 代码来源:objectVisibilityManager.php
示例14: nodeHasForbiddenWords
/**
* @param eZContentObjectTreenode $node
* @param array $row
* @return array
*/
protected static function nodeHasForbiddenWords( &$node, &$row )
{
/* @type $clustersToHide array */
$clustersToHide = eZINI::instance( 'merck.ini' )->variable( 'PublishSettings', 'clustersToHide' );
$returnArray = array();
foreach ($clustersToHide as $cluster)
{
/* @type $languageList array */
$clusterIni = eZINI::fetchFromFile( "./extension/$cluster/settings/site.ini" );
$languageList = $clusterIni->variable('RegionalSettings', 'SiteLanguageList');
foreach( $languageList as $locale )
{
/* @type $nodeDatamap eZContentObjectAttribute[] */
$nodeDatamap = $node->object()->fetchDataMap(false, $locale);
if( !$nodeDatamap )
continue;
if( $nodeDatamap['forbidden_article']->attribute('data_int') == 1 )
{
// node is marked from publisher as containing some forbidden words = we hide
$returnArray[$cluster] = array(
'toHide' => true,
'toDelete' => true,
'comment' => 'marked by publisher',
);
break;
}
$forbiddenWordsArray = self::getForbiddenWordsArray($cluster);
if(empty($forbiddenWordsArray))
{
$returnArray[$cluster] = array(
'toHide' => false,
'toDelete' => true,
'comment' => 'no forbidden words on cluster',
);
continue;
}
$lgExplode = explode('-', $locale);
$languageFilter = $lgExplode[0] . '-*';
$params = array(
'indent' => 'on',
'qt' => 'standard',
'q' => '*:*',
'start' => 0,
'stop' => 0,
'fq' => implode(' AND ', array(
'meta_node_id_si:'.$node->attribute('node_id'),
'meta_language_code_ms:'.$languageFilter,
'meta_installation_id_ms:'.eZSolr::installationID()
)),
);
$isInSolrResult = SolrTool::rawSearch($params, 'php', false);
if( !$isInSolrResult['response']['numFound'] )
{
// the node is not in solr. We postpone its check
if( $row['created'] < time() - 3600 * 4 )
{
// the node was added more than 4 hours ago. It should be in solr. We ask for a reindex
eZSearch::addObject( $node->object() );
$returnArray[$cluster] = array(
'toHide' => true,
'toDelete' => false,
'comment' => 'not indexed in solr yet',
);
break;
}
if( $row['created'] < time() - 3600 * 48 )
{
eZLog::write( sprintf( "%s\t Node %s still not in solr after 48h", date('Y-m-d H:i:s'), $node->attribute('node_id') ), 'updatevisibility.log' );
$returnArray[$cluster] = array(
'toHide' => true,
'toDelete' => true,
'comment' => 'node is taking too long to be indexed',
);
break;
}
}
$params['q'] = implode(' ', $forbiddenWordsArray);
$solrResults = SolrTool::rawSearch($params, 'php', false);
if( !$solrResults['response']['numFound'] )
{
// content has forbidden words => we hide
//.........这里部分代码省略.........
开发者ID:sushilbshinde, 项目名称:ezpublish-study, 代码行数:101, 代码来源:nodevisibilitycheck.php
示例15: updateObjectState
/**
* Update a contentobject's state
*
* @param int $objectID
* @param int $selectedStateIDList
*
* @return array An array with operation status, always true
*/
public static function updateObjectState($objectID, $selectedStateIDList)
{
$object = eZContentObject::fetch($objectID);
// we don't need to re-assign states the object currently already has assigned
$currentStateIDArray = $object->attribute('state_id_array');
$selectedStateIDList = array_diff($selectedStateIDList, $currentStateIDArray);
// filter out any states the current user is not allowed to assign
$canAssignStateIDList = $object->attribute('allowed_assign_state_id_list');
$selectedStateIDList = array_intersect($selectedStateIDList, $canAssignStateIDList);
foreach ($selectedStateIDList as $selectedStateID) {
$state = eZContentObjectState::fetchById($selectedStateID);
$object->assignState($state);
}
//call appropriate method from search engine
eZSearch::updateObjectState($objectID, $selectedStateIDList);
eZContentCacheManager::clearContentCacheIfNeeded($objectID);
return array('status' => true);
}
开发者ID:EVE-Corp-Center, 项目名称:ECC-Website, 代码行数:26, 代码来源:ezcontentoperationcollection.php
示例16: 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
示例17: 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
示例18: array
$keyArray = array(array('section', $searchSectionID), array('section_identifier', $section->attribute('identifier')));
$res->setKeys($keyArray);
}
$viewParameters = array('offset' => $Offset);
$searchData = false;
$tpl->setVariable("search_data", $searchData);
$tpl->setVariable("search_section_id", $searchSectionID);
$tpl->setVariable("search_subtree_array", $subTreeArray);
$tpl->setVariable('search_timestamp', $searchTimestamp);
$tpl->setVariable("search_text", $searchText);
$tpl->setVariable('search_page_limit', $searchPageLimit);
$tpl->setVariable("view_parameters", $viewParameters);
$tpl->setVariable('use_template_search', !$useSearchCode);
if ($http->hasVariable('Mode') && $http->variable('Mode') == 'browse') {
if (!isset($searchResult)) {
$searchResult = eZSearch::search($searchText, array("SearchType" => $searchType, "SearchSectionID" => $searchSectionID, "SearchSubTreeArray" => $subTreeArray, 'SearchTimestamp' => $searchTimestamp, "SearchLimit" => $pageLimit, "SearchOffset" => $Offset));
}
$sys = eZSys::instance();
$searchResult['RequestedURI'] = "content/search";
// $searchResult['RequestedURISuffix'] = $sys->serverVariable( "QUERY_STRING" );
$searchResult['RequestedURISuffix'] = 'SearchText=' . urlencode($searchText) . ($searchTimestamp > 0 ? '&SearchTimestamp=' . $searchTimestamp : '') . '&BrowsePageLimit=' . $pageLimit . '&Mode=browse';
return $Module->run('browse', array(), array("NodeList" => $searchResult, "Offset" => $Offset, "NodeID" => isset($subTreeArray[0]) && $subTreeArray[0] != 1 ? $subTreeArray[0] : null));
}
// --- Compatibility code start ---
if ($useSearchCode) {
$tpl->setVariable("offset", $Offset);
$tpl->setVariable("page_limit", $pageLimit);
$tpl->setVariable("search_text_enc", urlencode($searchText));
$tpl->setVariable("search_result", $searchResult["SearchResult"]);
$tpl->setVariable("search_count", $searchResult["SearchCount"]);
$tpl->setVariable("stop_word_array", $searchResult["StopWordArray"]);
开发者ID:legende91, 项目名称:ez, 代码行数:31, 代码来源:search.php
GitbookIO/gitbook:
阅读:954| 2022-08-17
juleswhite/mobile-cloud-asgn1
阅读:1029| 2022-08-30
kyamagu/matlab-json: Use official API: https://mathworks.com/help/matlab/json-fo
阅读:924| 2022-08-17
书名:墙壁眼睛膝盖 作者:温柔一刀 类别:欲望丛林,饮食男女。 簡介:Wall(我)Eye(爱)Kn
阅读:655| 2022-11-06
前言 在编写MATLAB程序时,我们可以不指定变量的数据类型。这使得MATALB编程很接近演
阅读:1519| 2022-07-18
sevenjay/cpp-markdown: Cpp-Markdown is a freely-available Markdown text-to-HTML
阅读:578| 2022-08-18
Q1: 多线程中需避免多个线程同时向全局变量进行写入操作,导致访问冲突问题。A1:
阅读:1193| 2022-07-18
An issue in the isSVG() function of Known v1.2.2+2020061101 allows attackers to
阅读:967| 2022-07-29
mathjax/MathJax-i18n: MathJax localization
阅读:387| 2022-08-16
众所周知,我们的身份证号码里面包含的信息有很多,如出生日期、性别和识别码等,如果
阅读:251| 2022-11-06
请发表评论