• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP eZSolr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: suggest

 /**
  * Provides suggestion results when adding tags to object
  *
  * @static
  * @param mixed $args
  * @return array
  */
 public static function suggest($args)
 {
     $tags = array();
     $siteINI = eZINI::instance('site.ini');
     if ($siteINI->variable('SearchSettings', 'SearchEngine') == 'ezsolr' && class_exists('eZSolr')) {
         $tagsCount = 1;
         $filteredTagsArray = array();
         $http = eZHTTPTool::instance();
         $tagsString = $http->postVariable('tags_string');
         $tagsArray = explode('|#', $tagsString);
         $subTreeLimit = $http->postVariable('subtree_limit');
         $hideRootTag = $http->postVariable('hide_root_tag') == '1' ? true : false;
         if (!empty($tagsArray) && strlen(trim($tagsArray[0])) > 0) {
             $solrFilter = '"' . trim($tagsArray[0]) . '"';
             $filteredTagsArray[] = strtolower(trim($tagsArray[0]));
             for ($i = 1; $i < count($tagsArray); $i++) {
                 if (strlen(trim($tagsArray[$i])) > 0) {
                     $solrFilter = $solrFilter . ' OR "' . trim($tagsArray[$i]) . '"';
                     $filteredTagsArray[] = strtolower(trim($tagsArray[$i]));
                     $tagsCount++;
                 }
             }
             $solrFilter = 'ezf_df_tags:(' . $solrFilter . ')';
             $solrSearch = new eZSolr();
             $params = array('SearchOffset' => 0, 'SearchLimit' => 0, 'Facet' => array(array('field' => 'ezf_df_tags', 'limit' => 5 + $tagsCount, 'mincount', 1)), 'SortBy' => null, 'Filter' => $solrFilter, 'QueryHandler' => 'ezpublish', 'FieldsToReturn' => null);
             $searchResult = $solrSearch->search('', $params);
             $facetResult = $searchResult['SearchExtras']->attribute('facet_fields');
             $facetResult = $facetResult[0]['nameList'];
             $tags = array();
             foreach ($facetResult as $facetValue) {
                 if (!in_array(strtolower($facetValue), $filteredTagsArray)) {
                     $tags[] = trim($facetValue);
                 }
             }
             if (!empty($tags)) {
                 $tags = eZTagsObject::fetchByKeyword(array($tags));
             }
         }
     }
     $returnArray = array();
     $returnArray['status'] = 'success';
     $returnArray['message'] = '';
     $returnArray['tags'] = array();
     foreach ($tags as $tag) {
         if (!$subTreeLimit > 0 || $subTreeLimit > 0 && strpos($tag->attribute('path_string'), '/' . $subTreeLimit . '/') !== false) {
             if (!$hideRootTag || $hideRootTag && $tag->attribute('id') != $subTreeLimit) {
                 $returnArrayChild = array();
                 $returnArrayChild['tag_parent_id'] = (int) $tag->attribute('parent_id');
                 $returnArrayChild['tag_parent_name'] = $tag->hasParent() ? $tag->getParent()->attribute('keyword') : '';
                 $returnArrayChild['tag_name'] = $tag->attribute('keyword');
                 $returnArrayChild['tag_id'] = (int) $tag->attribute('id');
                 $returnArray['tags'][] = $returnArrayChild;
             }
         }
     }
     return $returnArray;
 }
开发者ID:netbliss,项目名称:eztags,代码行数:64,代码来源:ezjscoretagssuggest.php


示例2: testGenerateConfiguration

    /**
     * test for generateConfiguration()
     */
    public function testGenerateConfiguration()
    {
        // clean up the table beforehand
        $db = eZDB::instance();
        $rows = $db->query('TRUNCATE TABLE ezfind_elevate_configuration;');
        $solr = new eZSolr();
        # start 1
        $queryString = "test 1";
        $objectID = 1;
        $object = eZContentObject::fetch($objectID);
        $language = "eng-GB";
        $docId = $solr->guid($object, $language);
        eZFindElevateConfiguration::add($queryString, $objectID, $language);
        eZFindElevateConfigurationTester::generateConfiguration();
        $configuration1 = eZFindElevateConfigurationTester::getConfiguration();
        $expected1 = <<<ENDT
<?xml version="1.0" encoding="UTF-8"?>
<elevate><query text="test 1"><doc id="
ENDT;
        $expected1 .= $docId;
        $expected1 .= <<<ENDT
"/></query></elevate>

ENDT;
        self::assertEquals($expected1, $configuration1);
        # end 1
    }
开发者ID:kevindejour,项目名称:ezfind,代码行数:30,代码来源:ezfindelevateconfiguration_test.php


示例3: rawSearch

    /**
     * Helper for solr raw searches.
     * Deals with the language, meta_installation, section and visibility filters + solr sharding if any
     * @param array $params
     * @param string $requestType
     * @param bool $useDefaultFilters
     * @return array
     */
    public static function rawSearch( $params, $requestType = 'php', $useDefaultFilters = true, $includeIsInvisible = true )
    {
        eZDebug::accumulatorStart( __CLASS__ . '::' . __FUNCTION__, 'Merck' );

        $findINI = eZINI::instance( 'ezfind.ini' );
        $solrINI = eZINI::instance( 'solr.ini' );
        $siteINI = eZINI::instance();
        $currentLanguage = $siteINI->variable( 'RegionalSettings', 'ContentObjectLocale' );

        // always use extended Dismax query handler when available
        if( isset($params['qt']) && $params['qt'] == 'ezpublish' )
            $params['defType'] = 'edismax';

        if ( $useDefaultFilters )
        {
            if ( !isset( $params['fq'] ) )
                $params['fq'] = '';
            else
                $params['fq'] .= ' AND ';
            $params['fq'] .= implode( ' AND ', array(
                'meta_installation_id_ms:' . eZSolr::installationID(),
                '(attr_offline_date_dt:"1970-01-01T01:00:00Z" OR attr_offline_date_dt:[NOW TO *])',
                '( meta_section_id_si:1 OR meta_section_id_si:3 )',
            ) );
            if ($includeIsInvisible) {
                $params['fq'] .= ' AND ' . 'attr_is_invisible_' . ClusterTool::clusterIdentifier() . '_b:false';
            }
        }

        if ( $findINI->variable( 'LanguageSearch', 'MultiCore' ) == 'enabled' )
        {
            $languageMapping = $findINI->variable( 'LanguageSearch', 'LanguagesCoresMap' );
            $shardMapping = $solrINI->variable( 'SolrBase', 'Shards' );
            $fullSolrURI = $shardMapping[$languageMapping[$currentLanguage]];
        }
        else
        {
            $fullSolrURI = $solrINI->variable( 'SolrBase', 'SearchServerURI' );
            // Autocomplete search should be done in current language and fallback languages
            $validLanguages = array_unique(
                array_merge(
                    LocaleTool::languageList(),
                    array( $currentLanguage )
                )
            );
            if( $useDefaultFilters )
                $params['fq'] .= ' AND meta_language_code_ms:(' . implode( ' OR ', $validLanguages ) . ')';
        }

        solrTool::solrStopWordsFilter( $params );    //excluding stopwords
        self::parseBooleanOperators( $params );      // translations for bookean operators
        $solrBase = new eZSolrBase( $fullSolrURI );
        $result = $solrBase->rawSolrRequest( '/select', $params, $requestType );
        if ( !$result )
            self::addNoCacheHeaders();
        
        eZDebug::accumulatorStop( __CLASS__ . '::' . __FUNCTION__ );

        return $result;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:68,代码来源:solrTool.php


示例4: filterQueryParams

 /**
  * Modifies SolR query params according to filter parameters
  * @param array $queryParams
  * @param array $filterParams
  * @return array $queryParams
  */
 public function filterQueryParams(array $queryParams, array $filterParams)
 {
     try {
         if (!isset($filterParams['field'])) {
             throw new Exception('Missing filter parameter "field"');
         }
         if (!isset($filterParams['latitude'])) {
             throw new Exception('Missing filter parameter "latitude"');
         }
         if (!isset($filterParams['longitude'])) {
             throw new Exception('Missing filter parameter "longitude"');
         }
         $fieldName = eZSolr::getFieldName($filterParams['field']);
         //geodist custom parameters
         $queryParams['sfield'] = $fieldName;
         $queryParams['pt'] = $filterParams['latitude'] . ',' . $filterParams['longitude'];
         //sort by geodist
         $queryParams['sort'] = 'geodist() asc,' . $queryParams['sort'];
         //exclude unlocated documents
         $queryParams['fq'][] = $fieldName . ':[-90,-90 TO 90,90]';
     } catch (Exception $e) {
         eZDebug::writeWarning($e->getMessage(), __CLASS__);
     }
     return $queryParams;
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:31,代码来源:ezfindgeodistextendedattributefilter.php


示例5: getChildrenClasses

 protected static function getChildrenClasses($parentNodeId)
 {
     $childrenClassTypes = array();
     if ($parentNode = self::getNode($parentNodeId)) {
         // ricavo gli identifiers delle classi e le classi
         $childrenClassTypes = array();
         $childrenClassesParamers = array('SearchSubTreeArray' => array($parentNode->attribute('node_id')), 'SearchLimit' => 1, 'Filter' => array('-meta_id_si:' . $parentNode->attribute('contentobject_id')), 'AsObjects' => false, 'Facet' => array(array('field' => 'meta_class_identifier_ms', 'name' => 'class_identifier', 'limit' => 200)));
         $solr = new eZSolr();
         $search = $solr->search('', $childrenClassesParamers);
         if ($search['SearchCount'] > 0) {
             $facets = $search['SearchExtras']->attribute('facet_fields');
             $childrenClassTypes = $facets[0]['nameList'];
         }
         if (!empty($childrenClassTypes)) {
             $childrenClassTypes = (array) eZContentClass::fetchList(0, true, false, null, null, $childrenClassTypes);
         }
     }
     return $childrenClassTypes;
 }
开发者ID:OpencontentCoop,项目名称:ocbootstrap,代码行数:19,代码来源:ocbtoolsfunctioncollection.php


示例6: suggest

 /**
  * Provides suggestion results when adding tags to object
  *
  * @static
  *
  * @param array $args
  *
  * @return array
  */
 public static function suggest($args)
 {
     $http = eZHTTPTool::instance();
     $searchEngine = eZINI::instance()->variable('SearchSettings', 'SearchEngine');
     if (!class_exists('eZSolr') || $searchEngine != 'ezsolr') {
         return array('status' => 'success', 'message' => '', 'tags' => array());
     }
     $tagIDs = $http->postVariable('tag_ids', '');
     if (empty($tagIDs)) {
         return array('status' => 'success', 'message' => '', 'tags' => array());
     }
     $tagIDs = array_values(array_unique(explode('|#', $tagIDs)));
     $solrSearch = new eZSolr();
     $params = array('SearchOffset' => 0, 'SearchLimit' => 0, 'Facet' => array(array('field' => 'ezf_df_tag_ids', 'limit' => 5 + count($tagIDs), 'mincount' => 1)), 'Filter' => array('ezf_df_tag_ids' => implode(' OR ', $tagIDs)), 'QueryHandler' => 'ezpublish', 'AsObjects' => false);
     $searchResult = $solrSearch->search('', $params);
     if (!isset($searchResult['SearchExtras']) || !$searchResult['SearchExtras'] instanceof ezfSearchResultInfo) {
         eZDebug::writeWarning('There was an error fetching tag suggestions from Solr. Maybe server is not running or using unpatched schema?', __METHOD__);
         return array('status' => 'success', 'message' => '', 'tags' => array());
     }
     $facetResult = $searchResult['SearchExtras']->attribute('facet_fields');
     if (!is_array($facetResult) || !is_array($facetResult[0]['nameList'])) {
         eZDebug::writeWarning('There was an error fetching tag suggestions from Solr. Maybe server is not running or using unpatched schema?', __METHOD__);
         return array('status' => 'success', 'message' => '', 'tags' => array());
     }
     $facetResult = array_values($facetResult[0]['nameList']);
     $tagsToSuggest = array();
     foreach ($facetResult as $result) {
         if (!in_array($result, $tagIDs)) {
             $tagsToSuggest[] = $result;
         }
     }
     if (empty($tagsToSuggest)) {
         return array('status' => 'success', 'message' => '', 'tags' => array());
     }
     return self::generateOutput(array('id' => array($tagsToSuggest)), 0, false, $http->postVariable('locale', ''));
 }
开发者ID:BornaP,项目名称:eztags,代码行数:45,代码来源:ezjsctags.php


示例7: search

 /**
  * Returns search results based on given params
  *
  * @param mixed $args
  * @return array
  * @deprecated Use ezjsc::search instead (in ezjscore)
  */
 public static function search($args)
 {
     $http = eZHTTPTool::instance();
     if ($http->hasPostVariable('SearchStr')) {
         $searchStr = trim($http->postVariable('SearchStr'));
     }
     $searchOffset = 0;
     if ($http->hasPostVariable('SearchOffset')) {
         $searchOffset = (int) $http->postVariable('SearchOffset');
     }
     $searchLimit = 10;
     if ($http->hasPostVariable('SearchLimit')) {
         $searchLimit = (int) $http->postVariable('SearchLimit');
     }
     if ($searchLimit > 30) {
         $searchLimit = 30;
     }
     if ($http->hasPostVariable('SearchSubTreeArray') && $http->postVariable('SearchSubTreeArray')) {
         $search_sub_tree_array = explode(',', $http->postVariable('SearchSubTreeArray'));
     }
     //Prepare the search params
     $param = array('SearchOffset' => $searchOffset, 'SearchLimit' => $searchLimit + 1, 'SortArray' => array('score', 0), 'SearchSubTreeArray' => $search_sub_tree_array);
     if ($http->hasPostVariable('enable-spellcheck') and $http->postVariable('enable-spellcheck') == 1) {
         $param['SpellCheck'] = array(true);
     }
     if ($http->hasPostVariable('show-facets') and $http->postVariable('show-facets') == 1) {
         $defaultFacetFields = eZFunctionHandler::execute('ezfind', 'getDefaultSearchFacets', array());
         $param['facet'] = $defaultFacetFields;
     }
     $solr = new eZSolr();
     $searchList = $solr->search($searchStr, $param);
     $result = array();
     $result['SearchResult'] = eZFlowAjaxContent::nodeEncode($searchList['SearchResult'], array(), false);
     $result['SearchCount'] = $searchList['SearchCount'];
     $result['SearchOffset'] = $searchOffset;
     $result['SearchLimit'] = $searchLimit;
     $result['SearchExtras'] = array();
     if (isset($param['SpellCheck'])) {
         $result['SearchExtras']['spellcheck'] = $searchList['SearchExtras']->attribute('spellcheck');
     }
     if (isset($param['facet'])) {
         $facetInfo = array();
         $retrievedFacets = $searchList['SearchExtras']->attribute('facet_fields');
         $baseSearchUrl = "/content/search/";
         eZURI::transformURI($baseSearchUrl, false, 'full');
         foreach ($defaultFacetFields as $key => $defaultFacet) {
             $facetData = $retrievedFacets[$key];
             $facetInfo[$key] = array();
             $facetInfo[$key][] = $defaultFacet['name'];
             if ($facetData != null) {
                 foreach ($facetData['nameList'] as $key2 => $facetName) {
                     $tmp = array();
                     if ($key2 != '') {
                         $tmp[] = $baseSearchUrl . '?SearchText=' . $searchStr . '&filter[]=' . $facetData['queryLimit'][$key2] . '&activeFacets[' . $defaultFacet['field'] . ':' . $defaultFacet['name'] . ']=' . $facetName;
                         $tmp[] = $facetName;
                         $tmp[] = "(" . $facetData['countList'][$key2] . ")";
                         $facetInfo[$key][] = $tmp;
                     }
                 }
             }
         }
         $result['SearchExtras']['facets'] = $facetInfo;
     }
     return $result;
 }
开发者ID:legende91,项目名称:ez,代码行数:72,代码来源:ezfindservercallfunctions.php


示例8: cleanUpAll

 /**
  * Clean all indices in current Solr core, regardless of installation id's
  * Only clean-up if --clean-all is set
  */
 protected function cleanUpAll()
 {
     if ($this->Options['clean-all']) {
         $this->CLI->output("eZSearchEngine: Cleaning up search data for all installations");
         $searchEngine = new eZSolr();
         // The essence of teh All suffix
         $allInstallations = true;
         // Optimize: sets all indexes to minimal file size too
         $optimize = true;
         $searchEngine->cleanup($allInstallations, $optimize);
     }
 }
开发者ID:legende91,项目名称:ez,代码行数:16,代码来源:updatesearchindexsolr.php


示例9: array

$wrong_path = array();



if ( !$top_node_id )
{
    $cli->error('Please provide a top node id');
    $script->shutdown(1);
}

$script->initialize();

$cli->output('Getting solr results for ' . $top_node_id);

/* @var $solr eZSolr */
$solr = new eZSolr();
$solrBase = new eZSolrBase();

$params = array(
    'indent'       => 'on',
    'q'            => '',
    'fq'           => 'meta_installation_id_ms:' . eZSolr::installationID() . ' AND meta_path_si:' . $top_node_id,
    'start'        => 0,
    'rows'         => 0,
    'fl'           => 'meta_main_url_alias_ms,meta_main_node_id_si,meta_name_t,meta_guid_ms,meta_language_code_ms',
    'qt'           => 'ezpublish',
    'explainOther' => '',
    'hl.fl'        => '',
);

$r = $solrBase->rawSolrRequest('/select', $params);
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:ezfindclean.php


示例10: solrFilter

function solrFilter ($publisherNode)
{
	$pathString = $publisherNode->attribute('path_string');
	$filters = array(
            "meta_class_identifier_ms:article",
			"main_node_meta_path_string_ms:$pathString*",
			'meta_installation_id_ms:' . eZSolr::installationID(),
	);
	
	return implode(' AND ', $filters);
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:11,代码来源:align_solr.php


示例11: solrTagCloud

 /**
  * Returns the tag cloud for specified parameters using eZ Find
  *
  * @param array $params
  *
  * @return array
  */
 private function solrTagCloud($params)
 {
     $offset = 0;
     if (isset($params['offset']) && is_numeric($params['offset'])) {
         $offset = (int) $params['offset'];
     }
     // It seems that Solr doesn't like PHP_INT_MAX constant on 64bit operating systems
     $limit = 1000000;
     if (isset($params['limit']) && is_numeric($params['limit'])) {
         $limit = (int) $params['limit'];
     }
     $searchFilter = array();
     if (isset($params['class_identifier'])) {
         if (!is_array($params['class_identifier'])) {
             $params['class_identifier'] = array($params['class_identifier']);
         }
         if (!empty($params['class_identifier'])) {
             $searchFilter['meta_class_identifier_ms'] = '(' . implode(' OR ', $params['class_identifier']) . ')';
         }
     }
     if (isset($params['parent_node_id'])) {
         $searchFilter['meta_path_si'] = (int) $params['parent_node_id'];
     }
     $solrSearch = new eZSolr();
     $solrParams = array('SearchOffset' => 0, 'SearchLimit' => 1000000, 'Facet' => array(array('field' => 'ezf_df_tag_ids', 'limit' => 1000000)), 'Filter' => $searchFilter, 'QueryHandler' => 'ezpublish', 'AsObjects' => false);
     $searchResult = $solrSearch->search('*:*', $solrParams);
     if (!isset($searchResult['SearchExtras']) || !$searchResult['SearchExtras'] instanceof ezfSearchResultInfo) {
         return array();
     }
     $facetResult = $searchResult['SearchExtras']->attribute('facet_fields');
     if (!is_array($facetResult) || empty($facetResult[0]['countList'])) {
         return array();
     }
     $tagsCountList = $facetResult[0]['countList'];
     /** @var eZTagsObject[] $tags */
     $tags = eZTagsObject::fetchList(array('id' => array(array_keys($tagsCountList))));
     if (!is_array($tags) || empty($tags)) {
         return array();
     }
     $tagSortArray = array();
     $tagKeywords = array();
     $tagCounts = array();
     foreach ($tags as $tag) {
         $tagKeyword = $tag->attribute('keyword');
         $tagCount = $tagsCountList[(int) $tag->attribute('id')];
         $tagSortArray[] = array('keyword' => $tagKeyword, 'count' => $tagCount, 'tag' => $tag);
         $tagKeywords[] = $tagKeyword;
         $tagCounts[] = $tagCount;
     }
     // calling call_user_func_array requires all arguments to be references
     // this is the reason for $sortFlags array and $sortArgs[] = &....
     $sortArgs = array();
     $sortFlags = array(SORT_ASC, SORT_DESC, SORT_LOCALE_STRING, SORT_NUMERIC);
     if (isset($params['sort_by']) && is_array($params['sort_by']) && !empty($params['sort_by'])) {
         $params['sort_by'] = is_string($params['sort_by'][0]) ? array($params['sort_by']) : $params['sort_by'];
         foreach ($params['sort_by'] as $sortItem) {
             if (is_array($sortItem) && !empty($sortItem)) {
                 switch ($sortItem[0]) {
                     case 'keyword':
                         $sortArgs[] =& $tagKeywords;
                         if (isset($sortItem[1]) && $sortItem[1]) {
                             $sortArgs[] =& $sortFlags[0];
                         } else {
                             $sortArgs[] =& $sortFlags[1];
                         }
                         $sortArgs[] =& $sortFlags[2];
                         break;
                     case 'count':
                         $sortArgs[] =& $tagCounts;
                         if (isset($sortItem[1]) && $sortItem[1]) {
                             $sortArgs[] =& $sortFlags[0];
                         } else {
                             $sortArgs[] =& $sortFlags[1];
                         }
                         $sortArgs[] =& $sortFlags[3];
                         break;
                 }
             }
         }
     }
     if (empty($sortArgs)) {
         $sortArgs[] =& $tagKeywords;
         $sortArgs[] =& $sortFlags[0];
     }
     $sortArgs[] =& $tagSortArray;
     call_user_func_array('array_multisort', $sortArgs);
     $tagSortArray = array_slice($tagSortArray, $offset, $limit);
     if (empty($tagSortArray)) {
         return array();
     }
     $tagKeywords = array_slice($tagKeywords, $offset, $limit);
     $tagCounts = array_slice($tagCounts, $offset, $limit);
     if (isset($params['post_sort_by'])) {
//.........这里部分代码省略.........
开发者ID:oki34,项目名称:eztags,代码行数:101,代码来源:eztagscloud.php


示例12: eject

 private function eject($objectId)
 {
     $object = eZContentObject::fetch($objectId);
     if ($object) {
         $engine = new eZSolr();
         $engine->removeObjectById($objectId);
     } else {
         echo "invalid object id\n";
     }
 }
开发者ID:truffo,项目名称:eep,代码行数:10,代码来源:index.php


示例13: attribute

 /**
  * Get attribute value
  *
  * @param string Attribute name
  *
  * @return mixed Attribute value. null if attribute does not exist.
  */
 public function attribute($attr)
 {
     switch ($attr) {
         case 'responseHeader':
             return $this->ResultArray['responseHeader'];
             break;
         case 'hasError':
             return !empty($this->ResultArray['error']);
             break;
         case 'error':
             if (!empty($this->ResultArray['error'])) {
                 return $this->ResultArray['error'];
             }
             break;
         case 'facet_queries':
             if (!empty($this->FacetQueries)) {
                 return $this->FacetQueries;
             }
             // If the facets count is empty, an error has occured.
             if (empty($this->ResultArray['facet_counts'])) {
                 return null;
             }
             $facetArray = array();
             foreach ($this->ResultArray['facet_counts']['facet_queries'] as $query => $count) {
                 list($field, $fieldValue) = explode(':', $query);
                 $fieldInfo = array('field' => $field, 'count' => $count, 'queryLimit' => $query, 'fieldValue' => $fieldValue);
                 $facetArray[] = $fieldInfo;
             }
             $this->FacetQueries = $facetArray;
             return $this->FacetQueries;
             break;
         case 'facet_fields':
             if (!empty($this->FacetFields)) {
                 return $this->FacetFields;
             }
             // If the facets count is empty, an error has occured.
             if (empty($this->ResultArray['facet_counts'])) {
                 return null;
             }
             $facetArray = array();
             foreach ($this->ResultArray['facet_counts']['facet_fields'] as $field => $facetField) {
                 switch ($field) {
                     // class facet field
                     case eZSolr::getMetaFieldName('contentclass_id'):
                         $fieldInfo = array('field' => 'class', 'count' => count($facetField), 'nameList' => array(), 'queryLimit' => array(), 'fieldList' => array(), 'countList' => array());
                         foreach ($facetField as $contentClassID => $count) {
                             if ($contentClass = eZContentClass::fetch($contentClassID)) {
                                 $fieldInfo['nameList'][$contentClassID] = $contentClass->attribute('name');
                                 $fieldInfo['queryLimit'][$contentClassID] = 'contentclass_id:' . $contentClassID;
                                 $fieldInfo['countList'][$contentClassID] = $count;
                                 $fieldInfo['fieldList'][$contentClassID] = 'contentclass_id';
                             } else {
                                 eZDebug::writeWarning('Could not fetch eZContentClass: ' . $contentClassID, __METHOD__);
                             }
                         }
                         $facetArray[] = $fieldInfo;
                         break;
                         // instalaltion facet field
                     // instalaltion facet field
                     case eZSolr::getMetaFieldName('installation_id'):
                         $findINI = eZINI::instance('ezfind.ini');
                         $siteNameMapList = $findINI->variable('FacetSettings', 'SiteNameList');
                         $fieldInfo = array('field' => 'installation', 'count' => count($facetField), 'nameList' => array(), 'queryLimit' => array(), 'fieldList' => array(), 'countList' => array());
                         foreach ($facetField as $installationID => $count) {
                             $fieldInfo['nameList'][$installationID] = isset($siteNameMapList[$installationID]) ? $siteNameMapList[$installationID] : $installationID;
                             $fieldInfo['queryLimit'][$installationID] = 'installation_id:' . $installationID;
                             $fieldInfo['countList'][$installationID] = $count;
                             $fieldInfo['fieldList'][$installationID] = 'installation_id';
                         }
                         $facetArray[] = $fieldInfo;
                         break;
                         // author facet field
                     // author facet field
                     case eZSolr::getMetaFieldName('owner_id'):
                         $fieldInfo = array('field' => 'author', 'count' => count($facetField), 'nameList' => array(), 'queryLimit' => array(), 'fieldList' => array(), 'countList' => array());
                         foreach ($facetField as $ownerID => $count) {
                             if ($owner = eZContentObject::fetch($ownerID)) {
                                 $fieldInfo['nameList'][$ownerID] = $owner->attribute('name');
                                 $fieldInfo['queryLimit'][$ownerID] = 'owner_id:' . $ownerID;
                                 $fieldInfo['countList'][$ownerID] = $count;
                                 $fieldInfo['fieldList'][$ownerID] = 'owner_id';
                             } else {
                                 eZDebug::writeWarning('Could not fetch owner ( eZContentObject ): ' . $ownerID, __METHOD__);
                             }
                         }
                         $facetArray[] = $fieldInfo;
                         break;
                         // translation facet field
                     // translation facet field
                     case eZSolr::getMetaFieldName('language_code'):
                         $fieldInfo = array('field' => 'translation', 'count' => count($facetField), 'nameList' => array(), 'queryLimit' => array(), 'fieldList' => array(), 'countList' => array());
                         foreach ($facetField as $languageCode => $count) {
                             $fieldInfo['nameList'][$languageCode] = $languageCode;
//.........这里部分代码省略.........
开发者ID:heliopsis,项目名称:ezfind,代码行数:101,代码来源:ezfsearchresultinfo.php


示例14: generateSubmetaFieldName

 /**
  * Generates the full Solr field name for a metadata subattribute.
  * Helper method to be used, if needed, by datatype-specific handlers.
  * Used particularly when indexing metadata of a related object.
  *
  * @param string $baseName
  * @param eZContentClassAttribute $classAttribute
  * @return string
  *
  * @example
  *      If $baseName equals 'main_url_alias', and $classAttribute
  *      has as identifier 'dummy', the return value will be :
  *      'submeta_dummy-main_url_alias_s'
  *
  * @see ezfSolrDocumentFieldObjectRelation
  */
 public static function generateSubmetaFieldName($baseName, eZContentClassAttribute $classAttribute)
 {
     return self::$DocumentFieldName->lookupSchemaName(self::SUBMETA_FIELD_PREFIX . $classAttribute->attribute('identifier') . self::SUBATTR_FIELD_SEPARATOR . $baseName, eZSolr::getMetaAttributeType($baseName));
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:20,代码来源:ezfsolrdocumentfieldbase.php


示例15: testGetMetaAttributesForObject

 /**
  * @dataProvider providerTestGetMetaAttributesForObject
  **/
 public function testGetMetaAttributesForObject($expected, $contentObject)
 {
     self::assertEquals($expected, eZSolr::getMetaAttributesForObject($contentObject));
 }
开发者ID:kminds,项目名称:ezfind,代码行数:7,代码来源:ezsolr_test.php


示例16: array

<?php

/* @type $cli eZCli */
/* @type $script eZScript */

$clusters        = ClusterTool::globCluster();
$solrLimit       = 200;
$globalObjectIds = array();
$solrStart       = 0;
$orFilters       = array();
$filters         = array(
    'meta_installation_id_ms:' . eZSolr::installationID(),
    "meta_class_identifier_ms:article",
);
$rawSolrParams = array(
    'indent'        => 'on',
    'q'             => '',
    'fl'            => "meta_id_si",
    'rows'          => $solrLimit,
    'qt'            => 'ezpublish',
);

foreach ( $clusters as $cluster )
{
    $orFilters[] = "attr_{$cluster}_url_s:full/*";
}
$filters[] = "( " . implode(' OR ', $orFilters ) . " )";

$rawSolrParams['fq'] = implode(' AND ', $filters);

while (true)
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:fixSolrUrls.php


示例17: getResponseSolr

    /**
     * @return array
     */
    public function getResponseSolr()
    {
        $applicationDictionaryRows = $this->prepareConfig();

        $forbiddenWords = NodeVisibilityCheck::getForbiddenWordsArray( $this->_cluster_identifier );
        $queryTerm = count($forbiddenWords) ? implode(' ', $forbiddenWords) : '*:*';

        foreach ( $applicationDictionaryRows as $applicationDictionaryRow )
        {
            // Get application node_id
            $applicationId = $applicationDictionaryRow['application_id'];

            /** @var ApplicationLocalized[] $_localApplication */
            $this->_localApplications[$applicationId] = CacheApplicationTool::buildLocalizedApplicationByApplication( $applicationId );

            $appLocalizedIsProper = ( $this->_localApplications[$applicationId] instanceof ApplicationLocalized );

            if ( !$appLocalizedIsProper )
            {
                eZDebug::writeError( sprintf( 'Cannot fetch localized application %s for cluster %s', $applicationId, $this->_cluster_identifier ), __FILE__ . '::' . __LINE__ );
                continue;
            }

            /* @type $validLanguages array */
            $newsletterStyle = $applicationDictionaryRow['newsletter_style'];
            $clusterSiteIni  = eZINI::fetchFromFile( "extension/{$this->_cluster_identifier}/settings/site.ini.append.php" );
            $validLanguages  = $clusterSiteIni->variable( 'RegionalSettings', 'SiteLanguageList' );

            // Common
            $fq = array(
                'meta_class_identifier_ms:"article"',
                '(attr_archive_date_dt:"1970-01-01T01:00:00Z" OR attr_archive_date_dt:[NOW TO *])',
                'meta_installation_id_ms:'.eZSolr::installationID(),
                'attr_is_invisible_' . $this->_cluster_identifier . '_b:false',
                'meta_language_code_ms:(' . implode( ' OR ', $validLanguages ) . ')',
            );
            
            $taxonomyList = json_decode( $applicationDictionaryRow['taxonomy_filter'], true );

            if(count($taxonomyList) > 0){
                foreach ($taxonomyList as $row) {
                    foreach($row as $taxonomyCategory => $taxonomies){
                        $taxonomies = array_map(function($value) { return '"' . $value . '"'; }, $taxonomies);
                        $fq[] = "subattr_{$taxonomyCategory}___source_id____s: (" . implode(',', $taxonomies) . ')';
                    }
                }
            }

            // NO SDK
            $publisherNodeIds = $this->_localApplications[$applicationId]->publisherNodeIds();
            if(count($publisherNodeIds) == 1 )
            {
                $newsletterStyle = $applicationDictionaryRow['newsletter_style'];

                $fq = array_merge($fq, array(
                    'meta_path_si:' . $publisherNodeIds[0],
                ));
            }
            elseif (count($publisherNodeIds) > 1 )
            {
                $publisherFilter = implode(' OR ', $publisherNodeIds);
                $newsletterStyle = $applicationDictionaryRow['newsletter_style'];

                $fq = array_merge($fq, array(
                        "meta_path_si:($publisherFilter)",
                    ));
            }
            /**
             * SDK Specific treatment; dead code for now
             *
                if ( $this->_localApplications[$applicationId] instanceof SDKApplication )
                {
                    // SDK application
                    $fq = array_merge($fq, array(
                        'subattr_local_application___source_id____s:' . $applicationId,
                        'is_sdk_b:true AND is_newsletter_b:true'
                    ));
                }
             *
             */

            // Solr query parameters
            $rows = 100000;
            $queryParams = array(
                'indent' => 'on',
                'q' => $queryTerm,
                'start' => 0,
                'rows' => $rows,
                'fq' => $fq,
                'fl' => array(
                    'attr_has_image_' . $this->_cluster_identifier . '_bst',
                    'meta_remote_id_ms',
                    'meta_node_id_si',
                    'meta_main_node_id_si',
                    'attr_featured_content_b',
                    'attr_date_dt',
                    'meta_path_string_ms',
//.........这里部分代码省略.........
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:101,代码来源:mmRssGenerator.php


示例18: fetch

 public function fetch($limit = 10, $offset = 0)
 {
     $fieldsToReturn = array();
     foreach (ITNewsletterPost::fields() as $field) {
         $fieldsToReturn[] = $field['solr_identifier'];
     }
     $solrFetchParams = array('SearchOffset' => $offset, 'SearchLimit' => $limit, 'Facet' => $this->facets, 'SortBy' => array('published' => 'desc'), 'Filter' => $this->filters, 'SearchContentClassID' => array(ITNewsletterPost::CLASS_IDENTIFIER), 'SearchSectionID' => null, 'SearchSubTreeArray' => array(eZINI::instance('content.ini')->variable('NodeSettings', 'RootNode')), 'AsObjects' => false, 'SpellCheck' => null, 'IgnoreVisibility' => null, 'Limitation' => null, 'BoostFunctions' => null, 'QueryHandler' => 'ezpublish', 'EnableElevation' => true, 'ForceElevation' => true, 'SearchDate' => null, 'DistributedSearch' => null, 'FieldsToReturn' => $fieldsToReturn, 'SearchResultClustering' => null, 'ExtendedAttributeFilter' => array());
     $solrSearch = new eZSolr();
     $tmp = $solrSearch->search($this->query, $solrFetchParams);
     return $tmp;
 }
开发者ID:informaticatrentina,项目名称:pat_base,代码行数:11,代码来源:itnewsletterposthandler.php


示例19: buildFetch

 public function buildFetch(OCClassSearchFormFetcher $fetcher, $requestValue, &$filters)
 {
     $bounds = OCClassSearchFormPublishedFieldBounds::fromString($this->attributes['value']);
     $filters[] = eZSolr::getMetaFieldName('published') . ':[' . $bounds->attribute('start_solr') . ' TO ' . $bounds->attribute('end_solr') . ']';
     $fetcher->addFetchField(array('name' => $this->attributes['label'], 'value' => $bounds->humanString(), 'remove_view_parameters' => $fetcher->getViewParametersString(array('publish_date'))));
 }
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:6,代码来源:occlasssearchformpublishedfield.php


示例20: elseif

    $fuzzyFilter = false;

    if ( $http->hasPostVariable( 'ezfind-searchelevateconfigurations-fuzzy' ) )
        $fuzzyFilter = true;
    elseif ( $Params['FuzzyFilter'] !== false )
        $fuzzyFilter = true;

    // Pass the fuzzy filter on to the template, search will occur there.
 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP eZSys类代码示例发布时间:2022-05-23
下一篇:
PHP eZSiteAccess类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap