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


PHP eZSolr::addObject方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     eZINI::instance('ezfind.ini')->loadCache(true);
     eZINI::instance('solr.ini')->loadCache(true);
     ezpINIHelper::setINISetting('site.ini', 'SearchSettings', 'AllowEmptySearch', 'enabled');
     ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'SiteLanguageList', array('eng-GB'));
     $this->solrSearch = new eZSolr();
     $this->testObj = eZContentObject::fetchByNodeID(2);
     $this->solrSearch->addObject($this->testObj);
     $this->fetchParams = array('SearchOffset' => 0, 'SearchLimit' => 10, 'Facet' => null, 'SortBy' => null, 'Filter' => null, 'SearchContentClassID' => null, 'SearchSectionID' => null, 'SearchSubTreeArray' => null, 'AsObjects' => null, 'SpellCheck' => null, 'IgnoreVisibility' => null, 'Limitation' => null, 'BoostFunctions' => null, 'QueryHandler' => 'ezpublish', 'EnableElevation' => null, 'ForceElevation' => null, 'SearchDate' => null, 'DistributedSearch' => null, 'FieldsToReturn' => null);
 }
开发者ID:netbliss,项目名称:ezfind,代码行数:12,代码来源:ezfindfetch_regression.php

示例2: setUp

 public function setUp()
 {
     parent::setUp();
     ezpINIHelper::setINISetting('site.ini', 'SearchSettings', 'AllowEmptySearch', 'enabled');
     ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'SiteLanguageList', array('eng-GB'));
     $this->findINI = eZINI::instance('ezfind.ini');
     $this->findINI->loadCache(true);
     $this->solrSearch = new eZSolr();
     $this->object = new ezpObject('folder', 2);
     $this->object->name = 'foo';
     $this->object->publish();
     $this->object->addNode(43);
     // Add a location under Media node
     $this->solrSearch->addObject($this->object->object);
 }
开发者ID:netbliss,项目名称:ezfind,代码行数:15,代码来源:ezsolr_regression.php

示例3: runSubProcess

 /**
  * Run sub process.
  *
  * @param int $nodeID
  * @param int $offset
  * @param int $limit
  */
 protected function runSubProcess($nodeID, $offset, $limit)
 {
     $count = 0;
     $node = eZContentObjectTreeNode::fetch($nodeID);
     if (!is_object($node)) {
         $this->CLI->error("An error occured while trying fetching node {$nodeID}");
         $this->Script->shutdown(3);
     }
     $searchEngine = new eZSolr();
     if ($subTree = $node->subTree(array('Offset' => $offset, 'Limit' => $limit, 'SortBy' => array(), 'Limitation' => array(), 'MainNodeOnly' => true))) {
         foreach ($subTree as $innerNode) {
             $object = $innerNode->attribute('object');
             if (!$object) {
                 continue;
             }
             //eZSearch::removeObject( $object );
             //pass false as we are going to do a commit at the end
             $result = $searchEngine->addObject($object, false, $this->commitWithin * 1000);
             if (!$result) {
                 $this->CLI->error(' Failed indexing ' . $object->attribute('class_identifier') . ' object with ID ' . $object->attribute('id'));
             }
             ++$count;
         }
     }
     $this->CLI->output($count);
     $this->Script->shutdown(0);
 }
开发者ID:legende91,项目名称:ez,代码行数:34,代码来源:updatesearchindexsolr.php

示例4: foreach

    }

    if ( $correct )
    {
        $cli->output("Removing ghosts from solr");
        $solrBase->deleteDocs($del_docs, false, true, false);
    }
}

if ( count($wrong_path) )
{
    $cli->output("\nWrong");
    foreach ( $wrong_path as $n )
    {
        $cli->output('[solr]: ' . $n->url_alias . ' [ez]: ' . $n->node()->urlAlias());
        if ( $correct )
        {
            $cli->output("Cleaning...");
            $solrBase->deleteDocs(array($n->guid));
            $solr->addObject($n->node()->object());
        }
    }
}



$cli->output("\nDone");

$script->shutdown();
?>
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:30,代码来源:ezfindclean.php

示例5: execute

 /**
  * Execute indexing of subtree
  *
  * @param int $nodeID
  * @param int $offset
  * @param int $limit
  *
  * @return int Number of objects indexed.
  */
 protected function execute($nodeID, $offset, $limit)
 {
     $count = 0;
     $node = eZContentObjectTreeNode::fetch($nodeID);
     if (!$node instanceof eZContentObjectTreeNode) {
         $this->CLI->error("An error occured while trying fetching node {$nodeID}");
         return 0;
     }
     $searchEngine = new eZSolr();
     $nodeTreeParams = array('Offset' => $offset, 'Limit' => $limit, 'SortBy' => array(), 'Limitation' => array(), 'MainNodeOnly' => true);
     if (count($this->classIdentifiers) > 0) {
         $nodeTreeParams['ClassFilterType'] = 'include';
         $nodeTreeParams['ClassFilterArray'] = $this->classIdentifiers;
     }
     if ($subTree = $node->subTree($nodeTreeParams)) {
         foreach ($subTree as $innerNode) {
             $object = $innerNode->attribute('object');
             if (!$object) {
                 continue;
             }
             //pass false as we are going to do a commit at the end
             $result = $searchEngine->addObject($object, false, $this->commitWithin * 1000);
             if (!$result) {
                 $this->CLI->error(' Failed indexing ' . $object->attribute('class_identifier') . ' object with ID ' . $object->attribute('id') . ' and main node id ' . $object->attribute('main_node_id'));
             }
             ++$count;
         }
     }
     return $count;
 }
开发者ID:kminds,项目名称:ezfind,代码行数:39,代码来源:updatesearchindexsolr.php

示例6: indexnode

 private function indexnode($nodeId)
 {
     $engine = new eZSolr();
     $node = eZContentObjectTreeNode::fetch($nodeId);
     $object = eZContentObject::fetch($node->attribute('contentobject_id'));
     if ($object) {
         $result = $engine->addObject($object, false);
         $engine->commit();
     }
 }
开发者ID:truffo,项目名称:eep,代码行数:10,代码来源:index.php

示例7: eZSolr

$info = false;
$detail = false;
$xml = false;
$solr = false;
$objectID = $Params['ObjectID'];
if (NULL == $Params['ObjectID']) {
    $error = "Object ID or object remote_id not found";
} else {
    $object = eZContentObject::fetch(intval($objectID));
    if (!$object instanceof eZContentObject) {
        $object = eZContentObject::fetchByRemoteID($objectID);
    }
    if ($object instanceof eZContentObject) {
        if ($object->attribute('can_read')) {
            $searchEngine = new eZSolr();
            $result = $searchEngine->addObject($object, true);
            $xmlData = fakeAddObject($object);
            if ($xmlData == false) {
                $result = false;
                $xmlData = array();
            }
            $info = array('object' => $object, 'result' => $result);
            $detail = array();
            $attributes = $object->dataMap();
            foreach ($attributes as $attribute) {
                $isSearchable = $attribute->attribute('contentclass_attribute')->attribute('is_searchable');
                $documentFieldBase = ezfSolrDocumentFieldBase::getInstance($attribute);
                $detail[] = array('attribute' => $attribute, 'name' => $attribute->attribute('contentclass_attribute_name'), 'identifier' => $attribute->attribute('contentclass_attribute_identifier'), 'data_type_string' => $attribute->attribute('data_type_string'), 'is_searchable' => $isSearchable, 'ez_metadata' => $isSearchable ? trim(print_r($attribute->metadata(), 1)) : false, 'solr_metadata' => $isSearchable ? trim(print_r($documentFieldBase->getData(), 1)) : false, 'solr_metadata_class' => $isSearchable ? get_class($documentFieldBase) : false);
            }
            $xml = array();
            foreach ($xmlData as $doc) {
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:31,代码来源:object.php

示例8: eZSolr

) );

$script->initialize();

if(!($nodesId = $options['nodesId']))
{
    $cli->error("nodesId param is mandatory");
    eZExecution::cleanExit();
}

$searchEngine = new eZSolr();
foreach(explode(",", $nodesId) as $nodeId)
{
    $node = eZContentObjectTreeNode::fetch($nodeId);
    $object = $node->attribute( 'object' );
    if ( !$object )
    {
        continue;
    }

    $result = $searchEngine->addObject( $object, false );
    if ( !$result )
    {
        $cli->error( ' Failed indexing ' . $object->attribute('class_identifier') .  ' object with ID ' . $object->attribute( 'id' ) );
    }
    eZContentObject::clearCache();
}

//$searchEngine->optimize( true );
$script->shutdown(0);
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:30,代码来源:indexnodes.php

示例9: eZSolr

 $searchEngine = new eZSolr();
 $needRemoveWithUpdate = $searchEngine->needRemoveWithUpdate();
 while (true) {
     $entries = $db->arrayQuery("SELECT param FROM ezpending_actions WHERE action = 'index_object' GROUP BY param ORDER BY min(created)", array('limit' => $limit, 'offset' => $offset));
     if (is_array($entries) && count($entries) != 0) {
         foreach ($entries as $entry) {
             $objectID = (int) $entry['param'];
             $cli->output("\tIndexing object ID #{$objectID}");
             $db->begin();
             $object = eZContentObject::fetch($objectID);
             $removeFromPendingActions = true;
             if ($object) {
                 if ($needRemoveWithUpdate) {
                     $searchEngine->removeObject($object, false);
                 }
                 $removeFromPendingActions = $searchEngine->addObject($object, false);
             }
             if ($removeFromPendingActions) {
                 $db->query("DELETE FROM ezpending_actions WHERE action = 'index_object' AND param = '{$objectID}'");
             } else {
                 $cli->warning("\tFailed indexing object ID #{$objectID}, keeping it in the queue.");
                 // Increase the offset to skip failing objects
                 ++$offset;
             }
             $db->commit();
         }
         $searchEngine->commit();
         // clear object cache to conserve memory
         eZContentObject::clearCache();
     } else {
         break;
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:31,代码来源:reindex_by_class.php


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