Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › User not appearing in search
- This topic has 14 replies, 2 voices, and was last updated 6 years, 2 months ago by
Ernest Marcinko.
-
AuthorPosts
-
November 20, 2019 at 6:49 pm #24677
spiritedsmoke56
ParticipantThere is a user on our site “Adam Eccleston” who will not appear in search results. We are searching by display name, {first_name} and {last_name} so I would expect that if you search for “Adam Eccleston” or “Adam” or “Eccleston” his name would appear, but he does not. I have tried searching with logic settings both OR and AND. I can not figure out what to manipulate to get him to appear in search results. I am concerned that this issue might appear when searching for other users as well. Can you help?
November 21, 2019 at 11:19 am #24680Ernest Marcinko
KeymasterHi,
It is due to an internal limitation (performance reasons), where the keyword logic applies to the whole of the field, and not the individual fields. It is possible to bypass that limit with a small custom code snippet. That should resolve the issue.
To add the bypass, please add this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
add_action('asp_query_args', 'asp_query_args_meta_changes'); function asp_query_args_meta_changes($args) { $args['user_search_meta_fields_separate_subquery'] = 1; return $args; }If you need help with it, you can add temporary FTP details, and I will do it for you.
November 21, 2019 at 5:36 pm #24704spiritedsmoke56
ParticipantOk that kind of worked. Now that we;ve put the code in, if I search “Eccleston” he will appear in searches. But if I search by “Adam” or “Adam Eccleston” he does not appear. Anything else we can try?
November 22, 2019 at 1:21 pm #24706Ernest Marcinko
KeymasterHi,
That is interesting, I am pretty sure that should work. Can you please add temporary FTP details as well? I would like to directly modify the plugin code to debug the query, to see what is wrong there.
November 23, 2019 at 10:51 am #24715spiritedsmoke56
ParticipantYou cannot access this content.
November 25, 2019 at 1:51 pm #24728Ernest Marcinko
KeymasterYou cannot access this content.
February 26, 2020 at 5:50 pm #26016spiritedsmoke56
ParticipantYou cannot access this content.
February 28, 2020 at 3:30 pm #26051spiritedsmoke56
ParticipantHey Ernest just wanted to confirm that you received my last message! thanks!
February 28, 2020 at 4:04 pm #26052Ernest Marcinko
KeymasterYou cannot access this content.
February 28, 2020 at 4:26 pm #26058spiritedsmoke56
ParticipantYou cannot access this content.
March 2, 2020 at 4:19 pm #26077Ernest Marcinko
KeymasterYou cannot access this content.
March 11, 2020 at 3:42 pm #26218spiritedsmoke56
Participantforgive me what does FTP stand for? I just want to make sure I’m sending the right thing!
March 11, 2020 at 4:04 pm #26223Ernest Marcinko
KeymasterYou cannot access this content.
March 11, 2020 at 6:14 pm #26231spiritedsmoke56
ParticipantYou cannot access this content.
March 12, 2020 at 2:04 pm #26234Ernest Marcinko
KeymasterHi!
Thank you very much, I was able to fix the issue.
There were two problems:
1. The code was incorrect, I made a mistake
2. The code was not active, since the child theme is not activeI corrected the code, and put it into the active theme directory functions file instead of the child theme file.
For future reference, the corrected version is:
add_filter('asp_query_args', 'asp_query_args_meta_changes', 10, 1); function asp_query_args_meta_changes($args) { $args['user_search_meta_fields_separate_subquery'] = 1; return $args; } -
AuthorPosts
- You must be logged in to reply to this topic.