How to use the Name Query in the User Search Service

Hello,

Can someone please guide me to some documentation or an example of how one would construct a name query for UserSearchService#findUsers(JiraServiceContext context, String query, UserSearchParams params)

Can I use regular expressions, is there some custom syntax, is this just using a string match etc?

Kind Regards,
Graham

Hi Graham,

String query in UserSearchService#findUsers method is just an ordinary string, no regular expressions are allowed.
Without going into details, user fields (username, email and display name) are tokenised on some special characters (space, ‘@’, ‘.’ etc) and then tokens are compared with query for matching start.

The details of the exact algorithm can be found in the source code of the classes com.atlassian.jira.bc.user.search.UserMatcherPredicate and com.atlassian.jira.bc.user.search.UserSearchUtilities.