-
AuthorPosts
-
January 25, 2018 at 12:34 pm #902793
Hi There,
We have a strange problem: Results from Search Box (out load) and Search Results Page are different.
This should be identical. Can you help us?
Many Thanks, T
January 26, 2018 at 6:18 am #903187Hey elbnetz,
Yes, they are different, they use different mechanisms. If you want them to be the same, please consider using a plugin, like Relevanssi or other.
http://www.wpbeginner.com/showcase/12-wordpress-search-plugins-to-improve-your-site-search/
If you need further assistance please let us know.
Best regards,
VictoriaJanuary 26, 2018 at 9:28 am #903266Hi Victoria,
Thanks for your quick reply. Unfortunately we can’t use Relevanssi as it is too slow with more than 63.000 posts.
BUT Could you describe what is the difference between the two results? What are the rules the two are following?Thanks, Thorsten
January 29, 2018 at 9:56 pm #904452Hi,
You would need to investigate what fit your needs, consulting is not something that we do inside our Support Scope.
Thank you
Best regards,
BasilisJanuary 30, 2018 at 10:32 am #904690I don’t need a consulting. I just want to know, which rules the two different search results are following.
Should be easy to communicate.Thanks!
January 30, 2018 at 11:06 pm #905221Hi,
Yes, but it does require someone who have deep understanding of that plugin so it is better to consider speaking with their support, as we cant know it inside and out.
We hope you do understand
Best regards,
BasilisJanuary 31, 2018 at 9:53 am #905450What plugin you are taking about?
Isn’t it Enfold which shows different results between Search Box (auto load) and Search Results Page?
Cheers
February 1, 2018 at 11:32 am #906222Hi,
The “Search Box” or the Ajax search relies on the get_posts function while the search results page is based on a direct database query.
($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}')
// https://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter
// https://wordpress.stackexchange.com/questions/115945/how-does-wordpress-search-work-behind-the-scenesI’m not really sure how it affects the search in general but you can use the “avf_ajax_search_query” filter to influence the ajax search results.
Best regards,
IsmaelFebruary 1, 2018 at 11:43 am #906234Hi Ismael,
Thanks for you answer. Our goal ist to have identical results. Or at least are able to communicate to our clients why are results different. Do I understand correctly that the “Ajax Search Box” is searching the titles only? And the search results page the full text of the website?
Where could we use the “avf_ajax_search_query”? Is there a special file?
And could that file be transferred to a child theme?Thanks,
ThorstenFebruary 2, 2018 at 2:48 am #906568Hi,
Please inform your clients that the search are queried differently, that’s why the results are different. Yes, it seems that the ajax search is searching for the keyword inside the posts content while the search results fetch posts based on the title. For example, you can’t find the “helle” keyword in the title of the first item (Reiff-Übernahme: Ein neuer Stern am europäischen Reifenhimme) in the ajax results. The keyword “helle” is inside the post content. The filter may not help at all if this is actually the case.
Best regards,
IsmaelFebruary 2, 2018 at 9:26 am #906732Hi Ismael,
Many Thanks for your comprehensive answer. Aren’t both (different) results based on the theme Enfold?
Why isn’t it in sync?And is there a way to improve search.php to make results equal to the ajax results?
Thanks again, Thorsten
February 5, 2018 at 3:48 am #907648Hi,
Aren’t both (different) results based on the theme Enfold?
Again, the main search result is base on the default WP search query while the search box is using the get_posts function (functions-enfold.php > avia_ajax_search). You can try the following filter but I’m not sure if it’s going to help.
add_filter('posts_search', 'avf_posts_search_mod', 9999, 2); function avf_posts_search_mod($search, $query) { global $wpdb; $like_op = 'LIKE'; $andor_op = 'AND'; $search = $wpdb->prepare( "(({$wpdb->posts}.post_excerpt $like_op %s) $andor_op ({$wpdb->posts}.post_content $like_op %s))", $_GET["s"], $_GET["s"] ); $search = " AND ({$search}) "; return $search; }
Best regards,
IsmaelFebruary 5, 2018 at 1:11 pm #907923Many Thanks,
Unfortunately it is not working. Getting a 404 error opening the website.
Anyway, I am wondering, why this discrepancy is only a problem with our client, no other is wondering about.Cheers,
Thorsten
February 5, 2018 at 3:04 pm #908026Hi Thorsten,
No, the discrepancy is there for all, many people chose to have other plugins for search, since search is not something that should be done by the theme and there are plenty of plugins out there.
If you need further assistance please let us know.
Best regards,
VictoriaFebruary 6, 2018 at 4:34 pm #908666Hi Victoria,
Thanks for your reply. Unfortunately we are talking about some 65.000 posts. Relevanssi and others are too slow for that blog.
Cheers,
ThorstenFebruary 6, 2018 at 8:48 pm #908796Hi,
I am afraid not a lot we can do further for it.
Most of the search is controlled from Enfold – or 3rd party plugins as Victoria said.Best regards,
BasilisFebruary 13, 2018 at 7:19 pm #911859is there a way to get rid of that ajax Search result suggestions
i mean that it will not run !
that will do it but it works in background.
.ajax_search_response {display: none}
February 14, 2018 at 3:32 am #912061Hi,
Unfortunately it is not working. Getting a 404 error opening the website.
Did you copy the code from your email? Please copy it directly from this forum. It’s not creating any errors on my installation.
@Guenni007: Disable the ajax form with this filter.add_filter('avf_ajax_form_class', 'avf_ajax_form_class_mod', 50, 3); function avf_ajax_form_class_mod($class, $formID, $form_params) { $class = 'avia-disable-default-ajax'; return $class; }
Best regards,
IsmaelFebruary 14, 2018 at 9:35 am #912156Did you copy the code from your email? Please copy it directly from this forum. It’s not creating any errors on my installation.
Yes, we copied from this forum. Still not working, I am afraid.
February 14, 2018 at 9:45 am #912162ismael : it still tries to find results:
and by the way : the code from https://kriesi.at/support/topic/results-from-search-box-and-search-results-page-are-different/#post-907648
leads to a 404 page on my installation too
- This reply was modified 6 years, 8 months ago by Guenni007.
February 15, 2018 at 2:55 am #912573Hi,
@Guenni007: My bad. That was for the ajax contact form. Please use this filter instead.add_action('avf_frontend_search_form_param', 'av_disable_ajax_search',9); function av_disable_ajax_search($params) { $params['ajax_disable'] = true; return $params; }
@elbnetz: Maybe, you should just disable the ajax search. Just use the filter above.Best regards,
IsmaelFebruary 15, 2018 at 6:28 pm #912854yes – thanks – thats it.
February 15, 2018 at 10:23 pm #912972Hi,
Glad we could help once in return! :D
Best regards,
Basilis -
AuthorPosts
- The topic ‘Results from Search Box and Search Results Page are different’ is closed to new replies.