Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1254946

    Hi,
    since a while I get multilanguage results via the ajax search. The Relevanssi support cannot give me a solution and answers “The Polylang language restriction is a taxonomy parameter. If the Enfold Ajax search overrides the taxonomy parameters, that would remove the Polylang restriction from the search. But as I don’t know what Enfold does, I can’t say if that’s the case. That would explain it, though.

    I already implemented your workarounds from your documentation. Doesn’t help. The result page shows the results correct. It’s just the ajax results that’s not working correct.
    I already deactivated all plugins to check if there’s a conflict with no results.

    You can test it via the search in the header on any page.

    Any idea what cause the problem?
    Thanks

    #1255763

    Any news here?

    #1255966

    Hi,

    Sorry for the delay. There are still mixed results in the search page when we use the default WordPress search field, so this might not be an issue with the AJAX search. Using the keyword “review” shows posts from both language. (see private field)

    Does it work correctly when a default or twenty theme is activated?

    Best regards,
    Ismael

    #1255977

    Hi Ismael, I’ve tested with the 2020 theme. There I’ll get only results from the current language. When I test it with a term I know it’s on the pages, the results are in the current language. I’ve tested with “crm” for example.

    Best regards

    • This reply was modified 3 years, 11 months ago by aicompcloud.
    #1257483

    Hey!

    Sorry for the delay. Is there a staging or a development version of the site? We would like to further check the issue in the development version of the site.

    We might be able to fix the issue with the AJAX search results using the following filter, but it will not work with the default search results. Please add this code in the functions.php file.

    /**
     * Ajax Search Query current language
     */
    function avf_modify_ajax_search_query($search_parameters)
    {
        $language = pll_current_language();
        parse_str($search_parameters, $params);
        $params['lang'] = $language; 
        $search_parameters = http_build_query($params);
        return $search_parameters;
    }
    add_filter('avf_ajax_search_query', 'avf_modify_ajax_search_query', 10, 1);
    
    function avf_modify_ajax_search_messages($search_messages)
    {
    	    $search_messages[all_results_link] = pll_home_url().'?'.http_build_query($_REQUEST);
            $search_messages[no_criteria_matched] = '<a class=\'ajax_search_entry ajax_search_entry_view_all\' href=\'' .$search_messages['all_results_link'].'\'>'.$search_messages['view_all_results'].'</a>';
        return $search_messages;
    }
    add_filter('avf_ajax_search_messages', 'avf_modify_ajax_search_messages', 10, 1);
    

    Cheers!
    Ismael

    #1257528

    Hi Ismael, I’ve tested it. Staging site login below. It works for the results page. But it didn’t work for the ajax results for example the search in the header bar.

    #1258971

    Hi,

    Thank you for the update.

    The filter should have only worked for the AJAX search, and not in the default search results page. What happens when you disable the Relevanssi plugin, or re-index the posts?

    Best regards,
    Ismael

    #1259204

    First check deactivating Relevanssi: When I deactivate Relevanssi I only get results from the current language.
    But I’m loosing the relevance in results.

    Second check re-index: I did it, but I still get results from both languages here.

    Is there another plugin I could try to bring back the relevance in the results that is compatible to enfold? Or do you have another idea what causes the problem?

    #1260044

    Hi,

    We could use the SearchWP plugin instead, then use this snippet in the functions.php file to integrate the plugin search query to the AJAX search form.

    // https://kriesi.at/support/topic/ajax-search-search-wp-doesnt-work/#post-1259151

    Thank you for your patience.

    Best regards,
    Ismael

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