Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
User Admin search behavior change in 7.4
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
- 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"
- 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"
- 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?
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?
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.
- 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)
- 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.
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