User Admin search behavior change in 7.4

Jan Tošovský, modified 3 Years ago. Liferay Master Posts: 576 Join Date: 7/22/10 Recent Posts

I've spot a difference in User Admin search behavior comparing 7.4 to 7.3. In the next text this pattern is used: first.last@domain.tld

  1. Entering just "last" to User Admin search field I could find the user in 7.3, but not in 7.4. In 7.4 I have to enter "first.last"
  2. I was also used to enter "@domain" to list matching users, but in 7.4 it only works without @ at the beginning, i.e. "domain"
  3. On the other hand, when entering entire email, in 7.4 I am getting just one matching result, while in 7.3 there were sometimes other entries (e.g. with same domain).

Especially (1) is quite annoying and unexpected. Is there any option to revert the behavior back?

thumbnail
Russell Bohl, modified 3 Years ago. Expert Posts: 308 Join Date: 2/13/13 Recent Posts

Regarding your number 1 (search by last name), it works on my machine in 7.4. Your users have a first and last name entered, correct? Not just an email address?

Jan Tošovský, modified 3 Years ago. Liferay Master Posts: 576 Join Date: 7/22/10 Recent Posts

I could spot the change, actually two, when inspecting postProcessSearchQuery() method in the custom UserIndexerPostProcessor.

There are two passed parameters, searchQuery and booleanFilter. Both of them slightly differs.

  1. while in 7.3 there is WildcardQuery in the searchQuery object for emailAddress in the form *keyword*, in 7.4 there is just keyword* (asterisk only at end)
  2. in 7.4 there is extra condition in the booleanFilter which reduces the list of searched fields to emailAdress and emailAddressDomain.

While the first issue can be workarounded by prepending asterisk to your keyword, you are still out of luck when searched term (e.g. first name) is not the part of email address.

I'll perform more tests and most likely file an issue.

Jan Tošovský, modified 3 Years ago. Liferay Master Posts: 576 Join Date: 7/22/10 Recent Posts

That point 2 is caused by my customization. If emailAddress is one of passed attributes, everything else is ignored. This logic is coded in this PreFilterContributor:

https://github.com/liferay/liferay-portal/blob/master/modules/apps/users-admin/users-admin-impl/src/main/java/com/liferay/users/admin/internal/search/spi/model/query/contributor/UserModelPreFilterContributor.java

After excluding emailAdress from passed attributes the keyword is searched in all attributes.

That 1 is something I can live with. Asterisks are added via private method _getTrailingWildcardQuery() here: 

https://github.com/liferay/liferay-portal/blob/master/modules/apps/users-admin/users-admin-impl/src/main/java/com/liferay/users/admin/internal/search/spi/model/query/contributor/UserKeywordQueryContributor.java