• Resolved chriswww

    (@chriswww)


    Hi Mikko,
    after updating to 3.6.2.2 the search results are not restricted to the current language anymore, but the results in all the languages are listed. When I return to 3.5.8 it’s fine again. So, no problem. Just wanted to mention it. Love this wonderful plugin!!

    Kind regards,
    Chris

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Polylang uses a taxonomy to control the language. Relevanssi in itself doesn’t have an opinion on it, so make sure your theme is not overriding the Polylang language settings.

    Thread Starter chriswww

    (@chriswww)

    Many thanks for your reply, Mikko! Just wonder, why the restriction is working well with Relevanssi 3.5.8, but not with 3.6.2.2. Seems like changes in the update cause this, doesn’t it?

    Plugin Author Mikko Saari

    (@msaari)

    The way the taxonomy queries are handled was changed in 3.5.12 in order to support nested taxonomy queries. That’s the only change I can think of that could do something about this.

    Does the restriction work if you update Relevanssi to 3.5.12? If not, does it work in 3.5.11? (You can find the old versions here.)

    Do you use other taxonomy parameters in the search?

    Thread Starter chriswww

    (@chriswww)

    Mikko, just tested more old versions and noticed, that Relevanssi lost the language restriction with version 3.6.2, v. 3.6.1 is doing it well.

    Plugin Author Mikko Saari

    (@msaari)

    Ok, that makes sense –?3.6.2 removed the specific Polylang filtering code. It was deemed unnecessary, because it wasn’t used anymore, because Polylang uses a tax_query to filter the languages. Version 4.0 will actually swing the other way and introduces a way to remove the language filter Polylang uses by default.

    So, Polylang should be doing the filtering by itself, with no help from Relevanssi. That’s why I was asking about taxonomy queries – Polylang should add one to your search to do the language filtering, and if you’re not seeing the language filtering, something else is probably messing up with the taxonomy query.

    Thread Starter chriswww

    (@chriswww)

    A pity, can’t find a solution to fix it. When I deactivate Relevanssi, restriction is made correctly by Polylang. When 3.6.2 is activated again, also the restriction has gone again. So I hope version 3.6.1 will work as long as possible in future WP versions.

    Plugin Author Mikko Saari

    (@msaari)

    Which version of Polylang are you using? The latest?

    Thread Starter chriswww

    (@chriswww)

    Yes, using the latest version. Will perhaps the mentioned modifications in version 4.0 solve this issue?

    Plugin Author Mikko Saari

    (@msaari)

    I just tested with Polylang today, and the language restriction works just as expected with version 4.0. It should work: the results are restricted by language, unless you choose otherwise.

    If it still doesn’t work, then it’s something specific to your site that is changing how the language filter works.

    Thread Starter chriswww

    (@chriswww)

    Working fine now with 4.0! Thank you very much, Mikko!
    Best,
    Chris

    What was the solution? I have the same problem now.
    Thank you.

    I also have the same issue now as well, seems to be related to admin-ajax results showing both languages? After updating beyond 3.6.1 I started having this issue. I think that specific Polylang filtering code as mentioned above is the cause but what is the solution? I will look into tax_query to filter the languages..

    Thread Starter chriswww

    (@chriswww)

    Perhaps something in the functions.php? I had to remove an obsolete filter “add_filter(‘relevanssi_modify_wp_query’, ‘rlv_remove_polylang’)” that I needed a long time ago.

    Plugin Author Mikko Saari

    (@msaari)

    Update to version 4.0.2 and remove any Relevanssi Polylang filters you may have added before to your theme functions.php.

    Thanks for getting back Chris/Mikko. I do not have any relevanssi plugin filters. I am using Searchautocomplete plugin(https://en-ca.www.ads-software.com/plugins/search-autocomplete/) which has ability to integrate with Relevanssi.

    Here is the relevant code I believe which is using relevanssi_do_query:

    public function acCallback() {
    		global $wpdb,
    		       $query,
    				$wp_query;
    		$resultsPosts = array();
    		$resultsTerms = array();
    		$term         = sanitize_text_field( $_GET['term'] );
    		if ( count( $this->options['autocomplete_posttypes'] ) > 0 ) {
    			<strong>if ( ( function_exists( 'relevanssi_do_query' ) && ( $this->options['autocomplete_relevanssi'] !== 'false' ) ) ) </strong>{
    				$query->query_vars['s']              = $term;
    				$query->query_vars['posts_per_page'] = $this->options['autocomplete_numrows'];
    				$query->query_vars['post_type']      = $this->options['autocomplete_posttypes'];
    				$query->query_vars['post_status']    = 'publish';
    				$query->query_vars['paged'] = 0;
    				$query->is_admin = $wp_query->is_admin;
    				relevanssi_do_query( $query );
    				$tempPosts = $query->posts;
    			} else {
    				$tempPosts = get_posts( array(
    					'suppress_filters' => false,
    					's'                => $term,
    					'numberposts'      => $this->options['autocomplete_numrows'],
    					'post_type'        => $this->options['autocomplete_posttypes'],
    				) );
    			}
    			foreach ( $tempPosts as $post ) {
    				$tempObject = array(
    					'id'       => $post->ID,
    					'type'     => 'post',
    					'taxonomy' => null,
    					'postType' => $post->post_type
    				);

    Any quick thoughts?

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘No language restriction with Polylang anymore’ is closed to new replies.