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

Exact match #8

Merged
merged 5 commits into from
Jul 12, 2022
Merged

Exact match #8

merged 5 commits into from
Jul 12, 2022

Conversation

mateonunez
Copy link
Collaborator

@mateonunez mateonunez commented Jul 12, 2022

This PR implements the #1 using a parameter that determinates if the search actions requires an exact match or not.

The find method of Trie nodes now accept an object as a single parameter. The type has been added: FindParams.

The solution found is to insert a check in the recursive function findAllWords, if the search actions requires an exact match and the word given by the last node doesn't match with the prefix, returns the initial output.

I wrote the tests for this, I'm considering add more tests if necessary.

packages/lyra/src/lyra.ts Outdated Show resolved Hide resolved
packages/lyra/src/prefix-tree/trie.ts Outdated Show resolved Hide resolved
@micheleriva
Copy link
Member

Hi @mateonunez!
Thank you so much for your contribution. I left a couple of comments 🙂

@micheleriva
Copy link
Member

Awesome, LGTM!

@micheleriva micheleriva merged commit ea8a516 into askorama:main Jul 12, 2022
@mateonunez mateonunez deleted the feat/exact-match branch July 12, 2022 12:51
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.

None yet

2 participants