getUserSearchFilter
\Bitrix\Main\UserUtils::getUserSearchFilter ( $fields )
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).
Parameters
Parameter | Description | Available from version |
---|---|---|
fields | Array can contain fields in any combination:
|
Example
$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 ))->fetchAll(); print_r($record);
© «Bitrix24», 2001-2024