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?
Relevanssi is set to show results only from current language in front.
What can i try?
Thank you
If you want posts from all languages, switch the setting so that posts from all languages are allowed.
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
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.
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;
}
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.