Jump to content

search function for multi language website

Recommended Posts

Currently working on a search function for a multi language website (DE, FR, IT).

If I'm on the FR (or IT) version of the website and start a search with a DE term, I also get FR (or IT) pages in the search result (because the default language field has this DE term).

How can I achieve that the find() function searches only in the field of the current user language?

The current selector looks like this:

$selector = "title|body~=$q, limit=50";


Share this post

Link to post
Share on other sites

Hi Robin S

Thanks a lot for your reply.

I tried the example in your linked post and it works:

$field = $user->language->isDefault() ? "body" : "body.data" . $user->language;

But in case of Repeaters it seems not to work. The following code throws an Error Exception: Multi-dot 'a.b.c' type selectors may not be used with OR '|' fields.

$field = $user->language->isDefault() ? "repeater_element.body" : "repeater_element.body.data" . $user->language;

I tried with sub-selectors, but couldn't get it to work fo far:


  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...