Documentation

OnSearch

string
handler function(
	string strQuery
);

"OnSearch" event is called prior to execution of search queries by the CSearch::Search method.

Parameters

Parameter Description
strQuery Search phrase. If the search by tag is used, "tags:" is added at the start.

Returned value

Handler function can return the "parameter=value" type string that will be added to the links of the found elements. Used by the statistics module to account the internal search index.

See Also

  • CSearch::Search
  • Example of handler function:

    <?
    // file /bitrix/php_interface/init.php
    // register the handler
    AddEventHandler("search", "OnSearch", Array("MyClass", "OnSearchHandler"));
    class MyClass { // create the "BeforeIndex" event handler function OnSearchHandler($strQuery) { if(strpos($strQuery, "tags:")!==false) return "tags_search=Y"; else return ""; } } ?>


    © «Bitrix24», 2001-2022
    Up