Rahaf91 / capstone-natural-cures

https://capstone-natural-cures.vercel.app
1 stars 0 forks source link

feature/search-bar_fixed_issues_with_regular_expression #50

Closed SylvieDoumet closed 2 months ago

SylvieDoumet commented 2 months ago

We have updated the code with a regular expression and an filtering option for the search result to fix the quality assurance issue that was that when "tea" was entered as a search term the results presented did not show all the teas stored in remedies.json but only some teas and also "thyme steam".

To get all teas we had to do a Fuse.js search at the beginning of a word or across the entire text corpus, regardless of where 'tea' occurs. To get "Tea for Cold" as well as "Thyme Tea for Cold". To assure to display all teas. The problem remaining was that "thyme steam" was still displayed. So we had to tell Fuse.js "I want "tea" to be at the beginning of any word."

For this, we had to filter the "any occurrence"- results from Fuse.js afterwards. And used a regular expression for that including \b (word boundary followed by searchterm) & i (case insensitivity).

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
capstone-natural-cures ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 15, 2024 3:22pm