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

Course search enhancements #2383

Merged
merged 1 commit into from
Feb 26, 2018
Merged

Course search enhancements #2383

merged 1 commit into from
Feb 26, 2018

Conversation

drewvolz
Copy link
Member

@drewvolz drewvolz commented Feb 25, 2018

Closes #2341

  • Fuzzy search
  • Search titles

The titles are additional to the course names.
Does not solve searching for names where middle initials prevent a match in prof names

* Fuzzy search
* Search titles
@stodevx-bot
Copy link

New dependencies added: fuzzysearch.

fuzzysearch

Author: Nicolas Bevacqua

Description: Tiny and blazing-fast fuzzy search in JavaScript

Homepage: https://github.com/bevacqua/fuzzysearch

Createdalmost 3 years ago
Last Updated4 months ago
LicenseMIT
Maintainers1
Releases4
README

fuzzysearch

Tiny and blazing-fast fuzzy search in JavaScript

Fuzzy searching allows for flexibly matching a string with partial input, useful for filtering data very quickly based on lightweight user input.

Demo

To see fuzzysearch in action, head over to bevacqua.github.io/horsey, which is a demo of an autocomplete component that uses fuzzysearch to filter out results based on user input.

Install

From npm

npm install --save fuzzysearch

fuzzysearch(needle, haystack)

Returns true if needle matches haystack using a fuzzy-searching algorithm. Note that this program doesn't implement levenshtein distance, but rather a simplified version where there's no approximation. The method will return true only if each character in the needle can be found in the haystack and occurs after the preceding character.

fuzzysearch('twl', 'cartwheel') // <- true
fuzzysearch('cart', 'cartwheel') // <- true
fuzzysearch('cw', 'cartwheel') // <- true
fuzzysearch('ee', 'cartwheel') // <- true
fuzzysearch('art', 'cartwheel') // <- true
fuzzysearch('eeel', 'cartwheel') // <- false
fuzzysearch('dog', 'cartwheel') // <- false

An exciting application for this kind of algorithm is to filter options from an autocomplete menu, check out horsey for an example on how that might look like.

But! RegExps...!

chart showing abysmal performance for regexp-based implementation

License

MIT

Generated by 🚫 dangerJS

@StoDevX StoDevX deleted a comment from buildsize bot Feb 26, 2018
@StoDevX StoDevX deleted a comment from buildsize bot Feb 26, 2018
@StoDevX StoDevX deleted a comment from buildsize bot Feb 26, 2018
@stodevx-bot
Copy link

iOS Report

Analysis of slow build times (>20s)
1m 19s: AllAboutOlaf/AllAboutOlaf [Release]
  1m 03s: Running script 'Bundle React Native code and images'
0m 26s: React/double-conversion [Release]
  0m 24s: Running script 'Install Third Party'
0m 11s: Bugsnag/BugsnagStatic [Release]
0m 14s: React/third-party [Release]
1m 06s: React/React [Release]
0m 12s: RCTGoogleAnalyticsBridge/RCTGoogleAnalyticsBridge [Release]
0m 30s: React/cxxreact [Release]

Generated by 🚫 dangerJS

@StoDevX StoDevX deleted a comment from buildsize bot Feb 26, 2018
@hannesmcman
Copy link
Member

Do we want to add search by description here?

(course.description || []).some(description =>
	description.toLowerCase().includes(query)
)

@drewvolz
Copy link
Member Author

Maybe. Thoughts, anyone else? @rye @hawkrives

@hawkrives
Copy link
Member

I feel like searching description is going to generate false positives and be really slow.

I'd like some benchmarks on search speed with and without description searching.

Just log performance.now before and after the filter process happens.

@hawkrives
Copy link
Member

With that said, I'd be fine with merging this PR as-is, and checking on description searching in a followup.

@drewvolz
Copy link
Member Author

Are you alright with merging these changes, @hannesmcman?

@drewvolz drewvolz merged commit ce490af into master Feb 26, 2018
@drewvolz drewvolz deleted the course-search-enhancements branch February 26, 2018 19:00
@rye rye added this to the v2.6 milestone Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants