Bitrix Site Manager

CPhrase::GetList

CDBResult
CPhrase::GetList(
 string &by = "s_id",
 string &order = "desc",
 array filter = array(),
 bool &is_filtered,
 int &total,
 string &group_by,
 int &max
)

The method GetList returns a list of search phrases, optionally grouped by search phrase or search engine.

Parameters

Parameter Description
by Sorting field. Depending on how the list is grouped, possible values of this parameters may vary.
  • grouping by search phrase (filter["GROUP"]="P"):
    • s_phrase - search phrase;
    • s_quantity - number of hits using a search phrase.
  • grouping by search engine (filter["GROUP"]="S"):
    • s_name - search engine;
    • s_quantity - number of hits from this search engine;
    • s_average_hits - average number of hits made by visitors from a search engine.
  • without grouping:
    • s_id - the record ID;
    • s_counter - counter;
    • s_site_id - the ID of the target site;
    • s_phrase - search phrase;
    • s_searcher_id - the ID of the search engine;
    • s_referer_id - the ID of the record from the referring page table;
    • s_date_hit - date of the hit;
    • s_url_to - target page;
    • s_session_id - the session ID.
order Sort order; the following values are possible:
  • asc - ascending;
  • desc - descending.
filter Array used to filter the resulting list. The following keys can be used in the array:
  • ID - the record ID;
  • ID_EXACT_MATCH - if set to "N", the ID can be an entry in the identifier string (loose match);
  • SESSION_ID - the session ID;
  • SESSION_ID_EXACT_MATCH - if set to "N", the SESSION_ID can be an entry in the identifier string (loose match);
  • SEARCHER_ID - the ID of the search engine;
  • SEARCHER_ID_EXACT_MATCH - if set to "N", the SEARCHER_ID can be an entry in the identifier string (loose match);
  • REFERER_ID - the ID of the record from the referring page table;
  • REFERER_ID_EXACT_MATCH - if set to "N", the REFERER_ID can be an entry in the identifier string (loose match);
  • SEARCHER* - name of the search engine;
  • SEARCHER_EXACT_MATCH - if set to "Y", the SEARCHER must match exactly;
  • DATE1 - the earliest date and time of the time period for which the information is to be returned;
  • DATE2 - the latest date and time of the time period;
  • PHRASE* - search phrase;
  • PHRASE_EXACT_MATCH - if set to "Y", the PHRASE must match exactly;
  • TO* - target page;
  • TO_EXACT_MATCH - if set to "Y", the TO must match exactly;
  • TO_404 - indicates the error 404 occurred on the target page (Y|N);
  • SITE_ID - the ID of the target site;
  • GROUP - how the resulting list is grouped; possible values:
    • P - grouping by the search phrase;
    • S - grouping by the search engine.
* - complex logic allowed.
is_filtered If this variable contains "true" on return, the resulting list is filtered.
total Total number of search phrases.
group_by How the list of search phrases is grouped. Possible values:
  • P - grouping by the search phrase;
  • S - grouping by the search engine.
max Number of hits using the most popular search phrase.

Structure of the returned record

The structure of the returned record varies depending on the grouping.

See Also

Example



<?
// we want only search phrases
// used for searches within the site
// using the internal search
$arFilter = array(
    "SEARCHER_ID"  => 1
    );

// obtain the list of records
$rs = CPhrase::GetList(
    ($by = "s_id"), 
    ($order = "desc"), 
    $arFilter, 
    $is_filtered,
    $total,
    $group_by,
    $max
    );

// print all records
while ($ar = $rs->Fetch())
{
    echo "<pre>"; print_r($ar); echo "</pre>";    
}
?>