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


PHP eZDebug::createAccumulator方法代码示例

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


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

示例1: get_html

 function get_html($url, $args = '', $asArray = false)
 {
     eZDebug::createAccumulator('get_html ' . $url, 'OCoembed', $url);
     eZDebug::accumulatorStart('get_html ' . $url, 'OCoembed', $url, false);
     $provider = false;
     if (!isset($args['discover'])) {
         $args['discover'] = false;
     }
     foreach ($this->providers as $matchmask => $data) {
         list($providerurl, $regex) = $data;
         // Turn the asterisk-type provider URLs into regex
         if (!$regex) {
             $matchmask = '#' . str_replace('___wildcard___', '(.+)', preg_quote(str_replace('*', '___wildcard___', $matchmask), '#')) . '#i';
         }
         if (preg_match($matchmask, $url)) {
             $provider = str_replace('{format}', 'json', $providerurl);
             // JSON is easier to deal with than XML
             break;
         }
     }
     if (!$provider && $args['discover']) {
         $provider = $this->discover($url);
     }
     if (!$provider || false === ($data = $this->fetch($provider, $url, $args))) {
         eZDebug::accumulatorStop('get_html ' . $url, false);
         return false;
     }
     if ($asArray) {
         eZDebug::accumulatorStop('get_html ' . $url, false);
         return get_object_vars($data);
     }
     eZDebug::accumulatorStop('get_html ' . $url, false);
     return $this->data2html($data, $url);
 }
开发者ID:rantoniazzi,项目名称:ocembed,代码行数:34,代码来源:ocoembed.php

示例2: search

 function search($searchText, $params = array(), $searchTypes = array())
 {
     eZDebug::createAccumulator('Search', 'eZ Find');
     eZDebug::accumulatorStart('Search');
     $error = 'Server not running';
     $asObjects = isset($params['AsObjects']) ? $params['AsObjects'] : true;
     //distributed search: fields to return can be specified in 2 parameters
     $params['FieldsToReturn'] = isset($params['FieldsToReturn']) ? $params['FieldsToReturn'] : array();
     if (isset($params['DistributedSearch']['returnfields'])) {
         $params['FieldsToReturn'] = array_merge($params['FieldsToReturn'], $params['DistributedSearch']['returnfields']);
     }
     $coreToUse = null;
     $shardQueryPart = null;
     if ($this->UseMultiLanguageCores === true) {
         $languages = $this->SiteINI->variable('RegionalSettings', 'SiteLanguageList');
         if (array_key_exists($languages[0], $this->SolrLanguageShards)) {
             $coreToUse = $this->SolrLanguageShards[$languages[0]];
             if ($this->FindINI->variable('LanguageSearch', 'SearchMainLanguageOnly') != 'enabled') {
                 $shardQueryPart = array('shards' => implode(',', $this->SolrLanguageShardURIs));
             }
         }
         //eZDebug::writeNotice( $languages, __METHOD__ . ' languages' );
         eZDebug::writeNotice($shardQueryPart, __METHOD__ . ' shards');
         //eZDebug::writeNotice( $this->SolrLanguageShardURIs, __METHOD__ . ' this languagesharduris' );
     } else {
         $coreToUse = $this->Solr;
     }
     if ($this->SiteINI->variable('SearchSettings', 'AllowEmptySearch') == 'disabled' && trim($searchText) == '') {
         $error = 'Empty search is not allowed.';
         eZDebug::writeNotice($error, __METHOD__);
         $resultArray = null;
     } else {
         eZDebug::createAccumulator('Query build', 'eZ Find');
         eZDebug::accumulatorStart('Query build');
         $queryBuilder = new ezfeZPSolrQueryBuilder($this);
         $queryParams = $queryBuilder->buildSearch($searchText, $params, $searchTypes);
         if (!$shardQueryPart == null) {
             $queryParams = array_merge($shardQueryPart, $queryParams);
         }
         eZDebug::accumulatorStop('Query build');
         eZDebugSetting::writeDebug('extension-ezfind-query', $queryParams, 'Final query parameters sent to Solr backend');
         eZDebug::createAccumulator('Engine time', 'eZ Find');
         eZDebug::accumulatorStart('Engine time');
         $resultArray = $coreToUse->rawSearch($queryParams);
         eZDebug::accumulatorStop('Engine time');
     }
     if ($resultArray) {
         $searchCount = $resultArray['response']['numFound'];
         $objectRes = $this->buildResultObjects($resultArray, $searchCount, $asObjects, $params);
         $stopWordArray = array();
         eZDebug::accumulatorStop('Search');
         return array('SearchResult' => $objectRes, 'SearchCount' => $searchCount, 'StopWordArray' => $stopWordArray, 'SearchExtras' => new ezfSearchResultInfo($resultArray));
     } else {
         eZDebug::accumulatorStop('Search');
         return array('SearchResult' => false, 'SearchCount' => 0, 'StopWordArray' => array(), 'SearchExtras' => new ezfSearchResultInfo(array('error' => ezpI18n::tr('ezfind', $error))));
     }
 }
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:57,代码来源:ocsolr.php

示例3: getClassAttributes

 /**
  * Get an array of class attribute identifiers based on either a class attribute
  * list, or a content classes list
  *
  * @param array $classIDArray
  *        Classes to search in. Either an array of class ID, class identifiers,
  *        a class ID or a class identifier.
  *        Using numerical attribute/class identifiers for $classIDArray is more efficient.
  * @param array $classAttributeID
  *        Class attributes to search in. Either an array of class attribute id,
  *        or a single class attribute. Literal identifiers are not allowed.
  * @param array $fieldTypeExcludeList
  *        filter list. List of field types to exclude. ( set to empty array by default ).
  *
  * @return array List of solr field names.
  */
 protected function getClassAttributes($classIDArray = false, $classAttributeIDArray = false, $fieldTypeExcludeList = null)
 {
     eZDebug::createAccumulator('Class attribute list', 'eZ Find');
     eZDebug::accumulatorStart('Class attribute list');
     $fieldArray = array();
     $classAttributeArray = array();
     // classAttributeIDArray = simple integer (content class attribute ID)
     if (is_numeric($classAttributeIDArray) and $classAttributeIDArray > 0) {
         $classAttributeArray[] = eZContentClassAttribute::fetch($classAttributeIDArray);
     } else {
         if (is_array($classAttributeIDArray)) {
             foreach ($classAttributeIDArray as $classAttributeID) {
                 $classAttributeArray[] = eZContentClassAttribute::fetch($classAttributeID);
             }
         }
     }
     // no class attribute list given, we need a class list
     // this block will create the class attribute array based on $classIDArray
     if (empty($classAttributeArray)) {
         // Fetch class list.
         $condArray = array("is_searchable" => 1, "version" => eZContentClass::VERSION_STATUS_DEFINED);
         if (!$classIDArray) {
             $classIDArray = array();
         } else {
             if (!is_array($classIDArray)) {
                 $classIDArray = array($classIDArray);
             }
         }
         // literal class identifiers are converted to numerical ones
         $tmpClassIDArray = $classIDArray;
         $classIDArray = array();
         foreach ($tmpClassIDArray as $key => $classIdentifier) {
             if (!is_numeric($classIdentifier)) {
                 if (!($contentClass = eZContentClass::fetchByIdentifier($classIdentifier, false))) {
                     eZDebug::writeWarning("Unknown content class identifier '{$classIdentifier}'", __METHOD__);
                 } else {
                     $classIDArray[] = $contentClass['id'];
                 }
             } else {
                 $classIDArray[] = $classIdentifier;
             }
         }
         if (!empty($classIDArray)) {
             $condArray['contentclass_id'] = array($classIDArray);
         }
         $classAttributeArray = eZContentClassAttribute::fetchFilteredList($condArray);
     }
     // $classAttributeArray now contains a list of eZContentClassAttribute
     // we can use to construct the list of fields solr should search in
     // @TODO : retrieve sub attributes here. Mind the types !
     foreach ($classAttributeArray as $classAttribute) {
         $fieldArray = array_merge(ezfSolrDocumentFieldBase::getFieldNameList($classAttribute, $fieldTypeExcludeList), $fieldArray);
     }
     // the array is unified + sorted in order to make it consistent
     $fieldArray = array_unique($fieldArray);
     sort($fieldArray);
     eZDebug::accumulatorStop('Class attribute list');
     return $fieldArray;
 }
开发者ID:kminds,项目名称:ezfind,代码行数:75,代码来源:ezfezpsolrquerybuilder.php

示例4: moreLikeThis

    /**
     * More like this is pretty similar to normal search, but usually only the object or node id are sent to Solr
     * However, streams or a search text body can also be passed .. Solr will extract the important terms and build a
     * query for us
     *
     * @param string $queryType is one of 'noid', 'oid', 'url', 'text'
     * @param $queryValue the node id, object id, url or text body to use
     * @param array parameters. @see ezfeZPSolrQueryBuilder::buildMoreLikeThis()
     *
     * @return array List of eZFindResultNode objects.
     *
     * @todo: add functionality not to call the DB to recreate objects : $asObjects == false
     */
    function moreLikeThis( $queryType, $queryValue, $params = array() )
    {
        eZDebug::createAccumulator( 'MoreLikeThis', 'eZ Find' );
        eZDebug::accumulatorStart( 'MoreLikeThis' );
        $error = 'Server not running';
        $searchCount = 0;
        //mlt does not support distributed search yet, so find out which is
        //the language core to use and qyery only this one
        //search across languages does not make sense here
        $coreToUse = null;
        if ( $this->UseMultiLanguageCores == true )
        {
            $languages = $this->SiteINI->variable( 'RegionalSettings', 'SiteLanguageList' );
            if ( array_key_exists ( $languages[0], $this->SolrLanguageShards ) )
            {
                $coreToUse = $this->SolrLanguageShards[$languages[0]];
            }
        }
        else
        {
            $coreToUse = $this->Solr;
        }

        if ( trim( $queryType ) == '' || trim( $queryValue ) == '' )
        {
            $error = 'Missing query arguments for More Like This: ' . 'querytype = ' . $queryType . ', Query Value = ' . $queryValue;
            eZDebug::writeNotice( $error, __METHOD__ );
            $resultArray = null;
        }
        else
        {
            eZDebug::createAccumulator( 'Query build', 'eZ Find' );
            eZDebug::accumulatorStart( 'Query build' );
            $queryBuilder = new ezfeZPSolrQueryBuilder( $this );
            $queryParams = $queryBuilder->buildMoreLikeThis( $queryType, $queryValue, $params );
            eZDebug::accumulatorStop( 'Query build' );

            eZDebug::createAccumulator( 'Engine time', 'eZ Find' );
            eZDebug::accumulatorStart( 'Engine time' );
            $resultArray = $coreToUse->rawSolrRequest( '/mlt', $queryParams );
            eZDebug::accumulatorStop( 'Engine time' );
        }

        if ( !$resultArray )
        {
            eZDebug::accumulatorStop( 'Search' );
            return array(
                'SearchResult' => false,
                'SearchCount' => 0,
                'StopWordArray' => array(),
                'SearchExtras' => new ezfSearchResultInfo( array( 'error' => ezpI18n::tr( 'ezfind', $error ) ) ) );
        }
        $objectRes = array();
        if ( isset( $resultArray['response'] ) && is_array( $resultArray['response'] ) )
        {
            $result = $resultArray['response'];
            $searchCount = $result['numFound'];
            $maxScore = $result['maxScore'];
            $docs = $result['docs'];
            $localNodeIDList = array();
            $nodeRowList = array();

            // Loop through result, and get eZContentObjectTreeNode ID
            foreach ( $docs as $idx => $doc )
            {
                if ( $doc[ezfSolrDocumentFieldBase::generateMetaFieldName( 'installation_id' )] == self::installationID() )
                {
                    $localNodeIDList[] = $doc[ezfSolrDocumentFieldBase::generateMetaFieldName( 'main_node_id' )];
                }
            }

            if ( count( $localNodeIDList ) )
            {
                $tmpNodeRowList = eZContentObjectTreeNode::fetch( $localNodeIDList, false, false );
                // Workaround for eZContentObjectTreeNode::fetch behaviour
                if ( count( $localNodeIDList ) === 1 )
                {
                    $tmpNodeRowList = array( $tmpNodeRowList );
                }
                if ( $tmpNodeRowList )
                {
                    foreach ( $tmpNodeRowList as $nodeRow )
                    {
                        $nodeRowList[$nodeRow['node_id']] = $nodeRow;
                    }
                }
                unset( $tmpNodeRowList );
//.........这里部分代码省略.........
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:101,代码来源:ezsolr.php

示例5: moreLikeThis

 /**
  * More like this is pretty similar to normal search, but usually only the object or node id are sent to Solr
  * However, streams or a search text body can also be passed .. Solr will extract the important terms and build a
  * query for us
  *
  * @param string $queryType is one of 'noid', 'oid', 'url', 'text'
  * @param $queryValue the node id, object id, url or text body to use
  * @param array parameters. @see ezfeZPSolrQueryBuilder::buildMoreLikeThis()
  *
  * @return array List of eZFindResultNode objects.
  *
  * @todo: add functionality not to call the DB to recreate objects : $asObjects == false
  */
 function moreLikeThis($queryType, $queryValue, $params = array())
 {
     eZDebug::createAccumulator('MoreLikeThis', 'eZ Find');
     eZDebug::accumulatorStart('MoreLikeThis');
     $error = 'Server not running';
     $asObjects = isset($params['AsObjects']) ? $params['AsObjects'] : true;
     //mlt does not support distributed search yet, so find out which is
     //the language core to use and qyery only this one
     //search across languages does not make sense here
     $coreToUse = null;
     if ($this->UseMultiLanguageCores == true) {
         $languages = $this->SiteINI->variable('RegionalSettings', 'SiteLanguageList');
         if (array_key_exists($languages[0], $this->SolrLanguageShards)) {
             $coreToUse = $this->SolrLanguageShards[$languages[0]];
         }
     } else {
         $coreToUse = $this->Solr;
     }
     if (trim($queryType) == '' || trim($queryValue) == '') {
         $error = 'Missing query arguments for More Like This: ' . 'querytype = ' . $queryType . ', Query Value = ' . $queryValue;
         eZDebug::writeNotice($error, __METHOD__);
         $resultArray = null;
     } else {
         eZDebug::createAccumulator('Query build', 'eZ Find');
         eZDebug::accumulatorStart('Query build');
         $queryBuilder = new ezfeZPSolrQueryBuilder($this);
         $queryParams = $queryBuilder->buildMoreLikeThis($queryType, $queryValue, $params);
         eZDebug::accumulatorStop('Query build');
         eZDebug::createAccumulator('Engine time', 'eZ Find');
         eZDebug::accumulatorStart('Engine time');
         $resultArray = $coreToUse->rawSolrRequest('/mlt', $queryParams);
         eZDebug::accumulatorStop('Engine time');
     }
     if ($resultArray) {
         $searchCount = $resultArray['response']['numFound'];
         $objectRes = $this->buildResultObjects($resultArray, $searchCount, $asObjects);
         $stopWordArray = array();
         eZDebugSetting::writeDebug('extension-ezfind-query-mlt', $resultArray['interestingTerms'], 'MoreLikeThis terms');
         return array('SearchResult' => $objectRes, 'SearchCount' => $searchCount, 'StopWordArray' => $stopWordArray, 'SearchExtras' => new ezfSearchResultInfo($resultArray));
     } else {
         return array('SearchResult' => false, 'SearchCount' => 0, 'StopWordArray' => array(), 'SearchExtras' => new ezfSearchResultInfo(array('error' => ezpI18n::tr('ezfind', $error))));
     }
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:56,代码来源:ezsolr.php


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