Documentation

GetList

CDBResult
CSearchTags::GetList( array arSelect = array(), array arFilter = array(), array arOrder = array(), int limit = 100 );

The method returns list of element tags of the search index. Static method.

This method uses the technology of managed caching (Cache Dependencies) if the search module constants are configured: CACHED_b_search_tags and CACHED_b_search_tags_len.

Method parameters

Parameter Description
arSelect Array, containing fields for selection.

Name of the field can have the following value:
  • NAME - tag;
  • CNT - tag frequency, number of elements of the search index containing this tag;
  • DATE_CHANGE - upper date limit (in full format) for the search index elements containing this tag;
Optional parameter. By default equals:
		array(
"NAME",
"CNT",
)
arFilter Array, containing filter as the "field name"=>"filter value" sets.

Name of the field can have the value:
  • SITE_ID - array of the site IDs;
  • TAG - tag start. All the tags that start with this value will be returned;
  • MODULE_ID - module ID;
  • PARAM1 - element first parameter;
  • PARAM2 - element second parameter;
Example:
		array(
"SITE_ID"=>array("s1"),
"TAG"=>"We",
"MODULE_ID"=>"iblock",
)
arOrder Array, containing the sorting attribute as the "field name"=>"direction" sets.

Name of the field can have the following value:
  • NAME - tag;
  • CNT - tag frequency, number of search index elements that contain this tag;
  • DATE_CHANGE - upper date limit (in full format) for the search index elements containing this tag;
Direction of sorting can have the following value:
  • ASC - by ascension;
  • DESC - by descension.
Optional parameter. By default equals:
		array(
"NAME"=>"ASC",
)
limit Limit of tag number in the results.

Returned values

The result of the CDBResult request type is returned. Fields that are listed in the arSelect parameters will become available when retrieving the result via CDBResult class methods.

See Also

Examples of use

Retrieving the list of ten most popular iblock module tags.
<?
//подключение модуля поиска
if(CModule::IncludeModule('search'))
{
$rsTags = CSearchTags::GetList(
array(),
array(
"MODULE_ID" => "iblock",
),
array(
"CNT" => "DESC",
),
10
);
while($arTag = $rsTags->Fetch())
print_r($arTag);
}
?>


© «Bitrix24», 2001-2024
Up