Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Search Algorithm #793

Merged
merged 2 commits into from
Jun 16, 2024
Merged

Improve Search Algorithm #793

merged 2 commits into from
Jun 16, 2024

Conversation

ijemmao
Copy link
Collaborator

@ijemmao ijemmao commented Jun 16, 2024

Describe your changes

  • No longer passing the search word through the expandNoun helper function. This helper function has been leading to a lot of false matches which confuses end users and ultimately lowers their trust in the quality of the platform.
  • Removed letter N in M regexes - there was a copy and paste mistake where if a user's search word included the letter m (case insensitive) then the generated wordReg, definitionsReg, and examplesReg would not only include the letter m but also the letter m in the regexes, which led to a lot of false matches.

Issue ticket number and link

Closed #785

Motivation and Context

Recently the quality of search has been pretty low.

How Has This Been Tested?

Ran all unit tests locally and updated stale tests.

Screenshots (if appropriate):

N/A

Copy link

vercel bot commented Jun 16, 2024

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

Name Status Preview Comments Updated (UTC)
igbo-api ❌ Failed (Inspect) Jun 16, 2024 6:01pm

@@ -592,7 +592,7 @@ describe('MongoDB Words', () => {
});

describe('/GET mongodb words V2', () => {
it('return word parts of mgba for noun deconstruction', async () => {
it.skip('return word parts of mgba for noun deconstruction', async () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skipping for now since we no longer call expandNoun

@@ -28,7 +28,7 @@
"dev:full:database": "npm-run-all -p start:watch start:emulators start:database:replica",
"dev:light": "npm-run-all -p start:watch start:database",
"dev:site": "npm-run-all -p start:emulators dev:site:next",
"dev:site:next": "firebase functions:config:set runtime.env=development && next",
"dev:site:next": "firebase functions:config:set runtime.env=development && next -p 3035",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explicitly setting the dev port to avoid clashing with other nkowaokwu projects

}))
: // @ts-expect-error no index signature with parameter type string
[{ text: searchWordPart, wordClass: [], regex: regexes[searchWordPart] }];
// if (!keywords.length && searchWord) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no longer calling expandNoun to avoid false matches

)}${'\u1e44\u01f9\u0144\u1e45\u01f8\u0143]'.normalize('NFC')}+[\u00B4\u0301\u0060\u00AF\u0304\u0323\u0300]{0,}`;
const caseInsensitiveM = `${'[m\u1e44\u01f9\u0144M\u1e45\u01f8\u0143'.normalize(
)}${'\u1e44\u01f9\u0144\u1e45\u01f8\u0143]'.normalize('NFC')}+[${ALL_DIACRITICS}]{0,}`;
const caseInsensitiveM = `${'[m\u1e40\u1e3fM\u1e41\u1e3e'.normalize(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turns out we copied the letter N's Unicode values instead of the letter M's

@ijemmao ijemmao merged commit ee2b6b9 into master Jun 16, 2024
5 of 6 checks passed
@ijemmao ijemmao deleted the io/785-improve-search-algorithm branch June 16, 2024 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Search Algorithm
1 participant