-
Notifications
You must be signed in to change notification settings - Fork 17
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
Search functionality should be centralized and implemented using established node packages #776
Comments
@jschanker I searched for alternative packages, but this seems to be the latest. I will implement a class for searching based on all attributes. |
@jschanker, take a look at this sandbox. I think this is the behavior that we want. |
@itsomkathe Looks good to me for basic search. In the future, we may want to add options such as limiting the number of results, only including results that start with the search word, sorting by the most relevant ones, etc. Also, something we should really start doing more is documenting using JSDoc and including unit tests, so I'd recommend doing that for |
@jschanker I've added the documentation for the |
@itsomkathe All you would have to do is create a |
@jschanker seems like
|
Is your feature request related to a problem? Please describe.
There are a number of places in the codebase where search functionality is being implemented independently of each other (courses, filtering in tutor dashboard, etc.). In addition to unnecessarily duplicating code, it can lead to undesired non-uniform behavior. For example, a search for "some" might yield all results including this word in one place but only ones starting with "some" in another so "something" would appear in both search results but "awesome" would only appear in one.
Additionally, we will want to make search efficient as the list of items we're searching through becomes very large and minimize potential bugs.
Describe the solution you'd like
Create a search component that uses its algorithm for search from an established node package. One possibility would be to use trie-search. Once constructed, a trie will have
O(m)
search wherem
is the length of the search term (independent of the number of items being searched through) so this will provide fast search for prefixes. Keeping the data from https://github.com/joshjung/trie-search#search-or-of-multiple-phrases but completely changing the functionality to filter rows from the data Array for which ALL searched terms are prefixes of one of the words/numbers from name/age/zip:Describe alternatives you've considered
Investigate other packages with search functionality.
Additional context
This issue is prompted by the discussion with @iamvaiibhav19 about implementing filter functionality for the Tutor dashboard. The above solution can be adapted to implement this functionality.
The text was updated successfully, but these errors were encountered: