Viewing 23 posts - 1 through 23 (of 23 total)
  • Author
    Posts
  • #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

    #903187

    Hey 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,
    Victoria

    #903266

    Hi 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

    #904452

    Hi,

    You would need to investigate what fit your needs, consulting is not something that we do inside our Support Scope.

    Thank you

    Best regards,
    Basilis

    #904690

    I 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!

    #905221

    Hi,

    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,
    Basilis

    #905450

    What plugin you are taking about?

    Isn’t it Enfold which shows different results between Search Box (auto load) and Search Results Page?

    Cheers

    #906222

    Hi,

    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-scenes

    I’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,
    Ismael

    #906234

    Hi 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,
    Thorsten

    #906568

    Hi,

    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,
    Ismael

    #906732

    Hi 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

    #907648

    Hi,

    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,
    Ismael

    #907923

    Many 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

    #908026

    Hi 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,
    Victoria

    #908666

    Hi Victoria,

    Thanks for your reply. Unfortunately we are talking about some 65.000 posts. Relevanssi and others are too slow for that blog.

    Cheers,
    Thorsten

    #908796

    Hi,

    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,
    Basilis

    #911859

    is 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}

    #912061

    Hi,

    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,
    Ismael

    #912156

    Did 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.

    #912162

    ismael : 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, 9 months ago by Guenni007.
    #912573

    Hi,


    @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,
    Ismael

    #912854

    yes – thanks – thats it.

    #912972

    Hi,

    Glad we could help once in return! :D

    Best regards,
    Basilis

Viewing 23 posts - 1 through 23 (of 23 total)
  • The topic ‘Results from Search Box and Search Results Page are different’ is closed to new replies.