Closed EPauli closed 1 month ago
https://github.com/teamtnt/laravel-scout-tntsearch-driver#constraints maybe this could help you out? ie. where language = 'en'...
Thank you for the response. I moved the toSearchableArray() function to another model. The pages are stored in the table 'page'. The localized data (like titles) is stored in the table 'localepage'. I moved toSearchableArray to the localepage model. That makes it easy to an extra where statement to filter on the language.
When use with Spatie Translatable package search only within one locale
Hello,
I'm using Laravel Scout with TNTSearch in my website. Everything works fine so far. I have defined a toSearchableArray() function in my Page model. This function creates an array with the title and content, so TNT Search can create an index with the data.
I can search on page titles and in the page contents. I wonder if there is a feature to make the search multilingual. The site has multiple languages. When I am on the Dutch website, I only want to see Dutch pages in the search result. When I am on the English website, I only want to see the English pages in the search results.
I cannot find how I can make the TNT search index multilingual. The documentation is not clear about this. Is this possible with a callback in the search() function?