laravel-scout-tntsearch-driver
laravel-scout-tntsearch-driver copied to clipboard
Something strange in search arabic
If i have sometext like "كتاب الصلاة" and searched by "صلاة" there is nothing, But if i typed "الصلاة" it gives results. So why? My settings: ` 'tntsearch' => [ 'storage' => storage_path(), //place where the index files will be stored 'fuzziness' => env('TNTSEARCH_FUZZINESS', false), 'fuzzy' => [ 'prefix_length' => 2, 'max_expansions' => 50, 'distance' => 2 ], 'asYouType' => false, 'searchBoolean' => env('TNTSEARCH_BOOLEAN', true), ],
`
And in .env: TNTSEARCH_FUZZINESS=auto
Now i'm forcing real problem, if word like "أصول" that contains "أ" not shows if i typed "اصول" without "أ", So how can i solve it?
As a workaround in the toSearchableArray
function, you can define the key as an array of possible values instead of the plain value
if the key is title
and holds the word: اصول you can return the title key as an array contains ['أصول', 'اصول']
If you already solved that issue please share your solution.
@BenMstfa Thanks, i didn't solve it but the client accept this thing. I don't have all prospects for all words, it's library, you can imagine.
I think if i converted all "أ" to "ا" in new column in database to search on it, will solve the problem, but i don't think it's the best solution, or what?