Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › search on multisite
This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko 1 year, 7 months ago.
- AuthorPosts
- August 3, 2021 at 5:38 pm #34149
I purchased this plugin so that I can use the search across a multisite environment however when I search within the multisites it does not combine the results based on relevance, For instance if i search for “CIM” I will mainly get results from the main site with CIM in the wording however their is a subsite dedicated to CIM that would have more relevant results. Those results will only display after every initial main site results has displayed. I was expecting them to be combined based on relevance no matter the site they belonged to. Is there a setting that can be toggled to manage this?
The search is on the right side of the header in the main site
Thanks
August 4, 2021 at 9:26 am #34156Hi!
Thank you for the details.
It should be the case by default, I guess there is some sort of an exception, which does not trigger the re-sorting of the results after all of them are fetched.
I can suggest a custom code to get around this, it is probably the best and fastest possible solution.
function asp_compare_by_relevance( $a, $b ) { return $b->relevance - $a->relevance; } add_filter( 'asp_results', 'asp_reorder_results_by_relevance', 10, 1 ); function asp_reorder_results_by_relevance( $results ) { usort($results, 'asp_compare_by_relevance'); return $results; }
Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
Let me know, if this changes anything. Thank you!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
August 13, 2021 at 4:03 pm #34274You cannot access this content.August 14, 2021 at 1:57 pm #34275Hi,
I tried to check, but the plugin is currently deactivated: https://i.imgur.com/k0FrSRq.png
Best,
Can you please also add temporary FTP access? I will try to debug the search code to see what is going on.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.