laravel-scout-tntsearch-driver
laravel-scout-tntsearch-driver copied to clipboard
Fuzzy search not working on special chacters
Hi, My problem is when I do a search for The Muslim Home - 40 Recommendations, I don't get a result, but when I search for The Muslim Home 40 Recommendations I get the article titled 'The Muslim Home - 40 Recommendations'. 'tntsearch' => [ 'storage' => env('TNTSEARCH_PATH', 'C:\xampp\htdocs\islamland\storage'), //place where the index files will be stored 'fuzziness' => env('TNTSEARCH_FUZZINESS', true), 'fuzzy' => [ 'prefix_length' => 0, 'max_expansions' => 50, 'distance' => 2 ], 'asYouType' => false, 'searchBoolean' => env('TNTSEARCH_BOOLEAN', false), ],
thanks
Do You Mean Arabic Language Like سبحان لله ?
@zymawy yes
Indeed, I Try It And This Is Not Working .
I Hard Code The Keyword And It Worked
$user = User: :sesrch("محمد")->get()
But With Variable Not Working
$user = User: :sesrch($request->q)->get()
I Think The Problem Is In The Unicode
Seems like a problem with your input..? On Thu, 28 Dec 2017 at 22:53, hamza zymawy [email protected] wrote:
Indeed, I Try It And This Is Not Working .
I Hard Code The Keyword And It Worked $user = User: :sesrch("محمد")->get()
But With Variable Not Working
$user = User: :sesrch($request->q)->get()
I Think The Problem Is In The Unicode
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/teamtnt/laravel-scout-tntsearch-driver/issues/133#issuecomment-354363699, or mute the thread https://github.com/notifications/unsubscribe-auth/ACDDWneEwGm0UYvgHLjTHJzmd3mAfme_ks5tFA3MgaJpZM4RMz9j .
@stokic The Problem Is When Searching IN Other Language Instead Of English There Is No Result Returned Did You Get It ?
Yes but you wrote that when you hardcode the word you do get the result, meaning the search is working correctly, but when you use a variable from the request you wrote that there are no results, so this means the problem is in the input/variable not the search itself.
Can you var dump an example search query to see what you get in the input variable?
Or maybe I didn’t understand your comment correctly? On Thu, 28 Dec 2017 at 23:03, hamza zymawy [email protected] wrote:
@stokic https://github.com/stokic The Problem Is When Searching IN Other Language Instead Of English There Is No Result Returned Did You Get It ?
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/teamtnt/laravel-scout-tntsearch-driver/issues/133#issuecomment-354365030, or mute the thread https://github.com/notifications/unsubscribe-auth/ACDDWpYP_8pxycnv5caAAW2vQhvEMAKSks5tFBBLgaJpZM4RMz9j .
@stokic Yes We Are Exactly In The Same Room When I Search In English It's Return The Result But In Arabic Not Returning Any Result Even Though There Is Recored With Same Kayword I Suggested That The Problem Is in The Unicode Maybe
Can you write a failing unit test so we can take a look?
My problem is bit different, it's when the phrase I am searching contain special character like <=>?@[]^_`{- I had to replace them using str_replace(), but it looks a weird solution for me. I agreed with @zymawy because I first had this problem when start working in project in Arabic
@asarach When You Had The Problem In Arabic lang how did You Solved ?
Here Is My Controller Function ` public function search(Request $request)
{
$categories = Category::search("المحاضرات")->get(); // Result True
var_dump($request->q); // Result string 'المحاضرات' (length=18) with arabic char one char 2 length
$categories = Category::search($request->q)->get(); // Result Null
$topics = Topic::search($request->q)->where('published', true)->get();
return view('pages.search', compact(
'categories',
'topics',
));`
}
It's Really Odd , Do I'm Missing Something ?
@zymawy it's not the same issue I think. I didn't have this problem and I can't see any reason why it's not working for you try turning fuzzy search 'false', maybe it's just in config files
Think You Every Thing Worked !! Fine
Faced the same issue while fuzzy search was enabled for Bengali text. After disabling fuzzy option search working perfectly.
Does the fuzzy search only available for English language only?
Trying to search a string with a comma or hyphen (, and -) among other special characters doesn't work in Dutch either (which shares the exact same alphabet as English).
teamtnt/tntsearch version: v1.4.0 (https://github.com/teamtnt/tntsearch/commit/60c2f6cba981a20183143cbd41ddfe3fd04aaed6)
teamtnt/laravel-scout-tnt-search-driver version: v3.3.0 (https://github.com/teamtnt/laravel-scout-tntsearch-driver/commit/e296a7fca2cf16dbc5542cf8eab724bc819b66df)
Settings:
'tntsearch' => [
'storage' => storage_path('tntsearch'),
'fuzziness' => false,
'fuzzy' => [
'prefix_length' => 2,
'max_expansions' => 50,
'distance' => 2
],
'asYouType' => false,
'searchBoolean' => true,
],
Turning boolean search off seems to be a workaround, but it's not really what I am looking for. I am now getting too many results.