Comments (7)
Wow, this looks really good! I'll take a deeper look into the code and then get back to you @LuukvE !
from list.js.
One problem with fuzzySearch, at this moment, is that it does not sort the list on relevance. Which is quite important, especially when many records are found.
Another option is to only use fuzzysearch when no other records are found. A "notFound" event could also be added to the list object, in order to make developers able to notify the app users.
from list.js.
Would it be possible to make the fuzzy search to a plugin?
And one more extra feature that would be awesome is that it could be possible to match a search over many columns at once? (I guess its just to concatenate the values and search). The reason for this request is the case where you have items looking like this
var item = {
firstName: "Jonny",
lastName: "Stromberg"
};
And then searches for "Jonny St" eg.
from list.js.
I added a commit which (optionally) splits the searchstring into arguments and iterates over all selected collumns. But this approach is I think not performant enough. I added a debounce to the search method to improve performance.
I agree, it is best to move all of this to a plugin, the plugin will probably just overwrite the default search method and perhaps do some pre-processing on all values in the list. A more advanced feature would be to sort on relevance.
from list.js.
Thanks @LuukvE – this is great!
I hadn't heard of the google diff-match tool before so I did some quick research: It uses the bitap algorithm which implements Levenshtein distance. I'm not a expert on this field, but from having played with some of these before, seems to me that this should be both speedy and pretty accurate.
Thanks!
from list.js.
Yes, my search actually went the other way around, first finding the Levenshtein distance and then the Bitap algorithm, and finally the Diff-match-patch project by Neil Fraser.
I ran some tests and the fuzzySearch method seems to be quicker than a regular expression search (using Chrome). Besides that we can use the Bitap score to sort the list based on relevance, which will make searching tremendously better. At this moment, especially with large (1000+) recordsets and short search strings the algoritm gets false-positives. Those should be lower in the list. Just like going to page 1000 of any Google search will only return nonsense.
from list.js.
sweet. I'm using list.js with datasets that can potentially load 1000s of records and hadn't gotten around to fixing the search problem yet. You've saved me a ton of time – thanks!
I think I'd vote with @javve – this might be better as a plugin. I can see a good use case for not wanting search to be sorted by relevancy and/or the extra power isn't needed.
from list.js.
Related Issues (20)
- Pagination
- How to get current sort column? HOT 2
- Differences between search and filter
- examples don't work
- it seems table header rows are not considered HOT 1
- toggleClass('active') is not working
- Getting Started examples seem incomplete? HOT 5
- Float type number cant be sorted
- .
- Is this project still maintained ? HOT 4
- bug with fuzzysearch ??? HOT 1
- Disappearing event listeners HOT 1
- How search in the E-mail?
- FuzzySearch plugin fails if the string items start with a line break \n
- Error cdn implementation
- Code for Prev and Next buttons
- list nested objects but not need a nested list HOT 1
- Search and filter problem HOT 1
- Serverside loading
- Avoid more CSP violations errors HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from list.js.