本文整理汇总了PHP中eZSolr类的典型用法代码示例。如果您正苦于以下问题:PHP eZSolr类的具体用法?PHP eZSolr怎么用?PHP eZSolr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZSolr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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
}
示例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;
}
示例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;
}
示例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;
}
示例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', ''));
}
示例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;
}
示例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);
}
}
示例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);
示例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);
}
示例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'])) {
//.........这里部分代码省略.........
示例12: eject
private function eject($objectId)
{
$object = eZContentObject::fetch($objectId);
if ($object) {
$engine = new eZSolr();
$engine->removeObjectById($objectId);
} else {
echo "invalid object id\n";
}
}
示例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;
//.........这里部分代码省略.........
示例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));
}
示例15: testGetMetaAttributesForObject
/**
* @dataProvider providerTestGetMetaAttributesForObject
**/
public function testGetMetaAttributesForObject($expected, $contentObject)
{
self::assertEquals($expected, eZSolr::getMetaAttributesForObject($contentObject));
}