\Bitrix\Main\UserUtils::getUserSearchFilter (

Static method allows getting specially-generated array for filtering in Main\UserTable::getList by fields with personal data (first name, last name, middle name, department name, position). Works in two modes: quick via Fulltext Index and slower mode via the right-side LIKE USER_NAME LIKE "Text%" - it is called a right-side like, when searching only by text starting at a specified phrase, but can contain different endings. Such search is significantly faster than dual "%text%" like or left-side "%text" - due to architecture for storage of indexed fields in database (support is defined automatically).


Parameter Description Available from version
fields Array can contain fields in any combination:
  • NAME - name
  • LAST_NAME - last name
  • SECOND_NAME - middle name
  • WORK_POSITION - position
  • UF_DEPARTMENT_NAME - department name
Or FIND - the field that searches in all listed fields (it's a analogue to the old CUser::GetList in which filter can be specified фильтр NAME_SEARCH and retrieve the result)


$filter = \Bitrix\Main\UserUtils::getUserSearchFilter(Array(
    'FIND' => 'Helen Martin'
$filter['IS_REAL_USER'] = 'Y'; 

$record = \Bitrix\Main\UserTable::getList(Array(
    'select' => Array('ID', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'WORK_POSITION', 'UF_DEPARTMENT'),
    'filter' => $filter


© «Bitrix24», 2001-2024