laravel-scout-tntsearch-driver icon indicating copy to clipboard operation
laravel-scout-tntsearch-driver copied to clipboard

Something strange in search arabic

Open MostafaRabia opened this issue 4 years ago • 3 comments

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

MostafaRabia avatar Sep 11 '20 16:09 MostafaRabia

Now i'm forcing real problem, if word like "أصول" that contains "أ" not shows if i typed "اصول" without "أ", So how can i solve it?

MostafaRabia avatar Sep 12 '20 07:09 MostafaRabia

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.

imkonsowa avatar Dec 29 '20 20:12 imkonsowa

@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?

MostafaRabia avatar Dec 30 '20 04:12 MostafaRabia