Support » Plugin: Relevanssi - A Better Search » WPML language index

  • Resolved Berger

    (@bergerteam)


    Hello,

    finally i had a problem indexing the languages (WPML). The Index was build and the search results are ok, but only for one language.
    Test 1
    1. Switch to native language (Backend)
    2. Indexing Relevanssi
    3. Search in native language -> OK
    4. Search in second language -> no results

    Test 2
    1. Switch to second language (Backend)
    2. Indexing Relevanssi
    3. Search in second language -> OK
    4. Search in native language -> no results

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

    (@msaari)

    Relevanssi always indexes all languages. How have you set up WPML searching in Relevanssi settings? Is Relevanssi set to show all languages, or only the current language?

    Berger

    (@bergerteam)

    Relevanssi is set to show results only from current language in front.
    What can i try?
    Thank you

    Plugin Author Mikko Saari

    (@msaari)

    If you want posts from all languages, switch the setting so that posts from all languages are allowed.

    Berger

    (@bergerteam)

    I have set:
    WPML Limit results to current language. Limit results to current language.
    Enabling this option will restrict the results to the currently active language. If the option is disabled, results will include posts in all languages.

    I need results in same language in frontend.
    The problem is:
    – if i index in backend in native language, the search results give me results in native language, but if i change to second language -> no full search results for second language
    – also if i index in backend in second language, the search results give me results in second language, but if i change to native language -> no full search results for native language

    Berger

    (@bergerteam)

    I have tested another time:
    The problem is the INDEX process. In second language (not setted language when indexing in backend) are indexed only product-titles, not the product-categories.

    Berger

    (@bergerteam)

    Is this the problem? Is this code working with WPML?

    // Relevanssi parent categories
    add_filter('relevanssi_content_to_index', 'rlv_parent_categories', 10, 2);
    function rlv_parent_categories($content, $post) {
    	$categories = get_the_terms($post->ID, 'product_cat');
    	if (is_array($categories)) {
    		foreach ($categories as $category) {
    			if (!empty($category->parent)) {
    				$parent = get_term($category->parent, 'product_cat');
    				$content .= $parent->name;
    			}
    		}
    	}
    	return $content;
    }
    Plugin Author Mikko Saari

    (@msaari)

    That filter indexes the parent category name, as provided by get_term(). It’s quite possible that doesn’t provide you the translated category name. Looks like you may need to replace the get_term() in the function with something that gets the matching terms in all languages. This is something where the WPML support should be able to help you.

    Berger

    (@bergerteam)

    Thank you, i will try.

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