Viewing 25 posts - 1 through 25 (of 25 total)
  • Author
    Posts
  • #912141

    I have the problem that when i type a text in the search field, it instantly (before i press the search button) shows “no results”. But when i press search button (magnifier glass) in will go to the search page and find page or post with that word in it.

    But it only happens on my mobile as you can see on attached dumps:

    https://www.dropbox.com/s/lpcmqb3zg5f0wde/Screenshot_20180214-075726.png?dl=0
    https://www.dropbox.com/s/18diofz5q97bd5g/search.jpg?dl=0

    Looks like an error in the mobile search function or am i doing something wrong?

    Kindly Jesper

    #912206

    Hey Jesper,

    I have tested the search the same as the screenshot you posted and I get the same results as the mobile. Here is the link to the screenshot: https://imgur.com/a/xU5Zw

    Best regards,
    Nikko

    #912538

    Thats a problem too, as it should find this page with the word “Evernote” in the headline.
    https://frieskolersledere.dk/category/maanedens-digitale-vaerktoej/

    Kindly Jesper

    #912693

    I too have an issue with mobile search. Is it due to the latest update? Seems the search on mobile is consequently omitting results when compared to the desktop site.

    Search terms:

    https://medi-paper.com/?s=NEPA
    https://medi-paper.com/?s=palonosetron
    https://medi-paper.com/?s=sutent
    https://medi-paper.com/?s=chemotherapy
    https://medi-paper.com/?s=immunotherapy

    #912926

    Hi,

    Can you please explain us
    ” consequently omitting results ”
    means?

    You mean that the results are not the same? That cant be possible at all.

    Best regards,
    Basilis

    #912938
    #912990

    Hi,

    Let us know if that could work.

    Best regards,
    Basilis

    #913125

    @Basilis: indeed, the results showing after search on mobile vs desktop are different.

    Sorry, but the solution posted here didn’t solve it.

    Please note: before testing I purged the Cloudflare Cache and switched to “Developmental Mode” to avoid caching issues. The results remain different, although the difference in search methods seem a plausible explanation.

    I have added this code to functions.php based on @Guenni007 information:
    functions.php code added

    The search result on desktop:
    Desktop Search

    The search result on mobile:
    Mobile Search

    Thanks for your support.

    #913417

    Hi,

    I have asked some of my colleges to take a look if they have an idea – because first time I see something like that

    Best regards,
    Basilis

    #913568

    Thank you, I appreciate it.

    #914006

    Hi,

    They have also checked – but we cant find something.
    AS you understand it is a really crazy issue, because the results have nothing to do with the screen size, but they are related to the WordPress Query.

    We do although keep trying to find out where the issue is, so we appreciate some more time.

    Best regards,
    Basilis

    #914104

    I fully appreciate it. I only found out myself when one of my customers kept searching their content on mobile, which led me to check. I can confirm that searches on mobile do lead to results, but generally fewer than on desktop. Thank you once more for looking into this.

    #914992

    Hi,

    Just updating that we are still trying to fin d out what is wrong.

    Best regards,
    Basilis

    #915314

    Thank you for the update, Basilis.

    Just wonder. This site is running Enfold too, but I don’t see the issue on your site (have tried mobile search and desktop search). The results seem the same. So a local issue on my site? Is it confined to my site only or do you have other reports?

    If only my site, perhaps I should first try disabling some plugins. If more reports, we could compare plugins and see if the culprit can be found. Not sure if it is logical though. Since you have explained abt WPQuery.

    #915649

    Hi,

    We have no other reports, that is why I check specific on your installation as it is something that is happening at your site only and not to anywhere else.

    Best regards,
    Basilis

    #915905

    Thank you, Basilis. I will try to do some troubleshooting later this week and update you on the outcome.
    Appreciate the support offered.

    #918861

    Hi Basilis,
    So I have switched off all plugins, but the issue remains. I am completely in the blue what is causing it. I am thinking that perhaps something I have added in my functions.php for the child theme is causing the issue. I am sort of in the blue where to look by now. Any thoughts? Just to be sure I have added the functions.php from my child theme. Thanks once more.

    #919580

    Hi,

    Please use this filter to alter the search query. It’s going to compare the search keyword to the post title instead of the content or excerpt.

    function __search_by_title_only( $search, $wp_query )
    {
        global $wpdb;
        if(empty($search)) {
            return $search; // skip processing - no search term in query
        }
        $q = $wp_query->query_vars;
        $n = !empty($q['exact']) ? '' : '%';
        $search =
        $searchand = '';
        foreach ((array)$q['search_terms'] as $term) {
            $term = esc_sql($wpdb->esc_like($term));
            $search .= "{$searchand}($wpdb->posts.post_title LIKE '{$n}{$term}{$n}')";
            $searchand = ' AND ';
        }
        if (!empty($search)) {
            $search = " AND ({$search}) ";
            if (!is_user_logged_in())
                $search .= " AND ($wpdb->posts.post_password = '') ";
        }
        return $search;
    }
    add_filter('posts_search', '__search_by_title_only', 500, 2);

    \

    You have to remove the previous filters.

    Best regards,
    Ismael

    #921254

    Dear Ismael,
    Thanks for your help. I do appreciate it. However, I think I rather go with a discrepancy in the search results between mobile and desktop than diminishing the search capabilities of my desktop site. Thanks once more for helping.

    #921766

    Hi,

    Thank u for update.

    Best regards,
    Basilis

    #921777

    Like explained in beginning of this thread, I have the issue as well, and also the response from Nikko is an error, as Nikko should find the page I link to in my answer. So the search problem is not just an issue on medi-papers site – and it took me a year to notice, so probably other sites have the problem too without noticing.
    Also it is not important enough for me to change code, make a chilldtheme or the like – just figured its a basic search function, that should work without workarounds.
    And appreciate all your effort guys!

    Kindly Jesper

    #921978

    Just wonder, when Nikko tested he was likely not signed in to your site. When I test, I am signed in as admin. How about you, Jesper?

    Because “sign in” status may play a role, I tested in a “private browsing” window. When logged out, the results on mobile and desktop seem the same on both. For logged in users, search results on desktop seem to include password protected posts, but on mobile, the password protected posts (although I am logged in) are omitted.

    Another observation is on ‘hidden posts’. When clicking the magnifying glass, I get an instant result of a page that is a testing page. The page is ‘hidden’ and does not show in the masonry. But when I click to see the search results page, the entry is not shown (I think this is the discrepancy Jesper mentioned).

    However, this is something I have noticed before, there is a difference between some elements when handling hidden content.

    I have tried:
    1) Blog Post
    2) Magazine
    3) Masonry
    4) Post Slider

    Of these 4, only Magazine includes “hidden entries”. Not sure if this is somehow related to the search or not, but it does show that where you would expect similar behaviour between elements, the behaviour can actually be different (us users don’t understand how hard it is to make everything perfect and create unity across the theme ;)).

    Thanks once more for the support.

    #922206

    Hi,

    Thank you for the info.


    @kjems
    : Do you mind if we take a look at the dashboard? Please provide the login details in the private field.


    @medi-paper
    : The “avf_frontend_search_form_param” is included in the codes that you posted from your functions.php file. That filter should disable the ajax search feature. I’m not sure why it’s not working in your installation.

    //Begin mobile search behaviour
    add_action(‘avf_frontend_search_form_param’, ‘av_disable_ajax_search’,9);
    function av_disable_ajax_search($params)
    {
    $params[‘ajax_disable’] = true;
    return $params;
    }
    

    If possible, please create a new thread with the site url and the login credentials. We would like to check the issue further.

    Best regards,
    Ismael

    #933346

    Thanks Ismael. I have sort of given up on this one :). You guys are the experts and apparently, this is some sort of odd behaviour. Thanks once more for the great support.

    #933373

    Hi medi-paper,

    Glad we could help :)

    If you need further assistance please let us know.
    Best regards,
    Victoria

Viewing 25 posts - 1 through 25 (of 25 total)
  • You must be logged in to reply to this topic.