Comments (6)
@derhuerst, I am not following. As it has been mentioned, the nature of Bitap is such that you'd have to pre-compute the score of the items against the search term before any sorting can take place. Ergo, I cannot see how Fuse would yield the top n items out of m without having calculated m number of scores.
from fuse.
Can you just break after iterating through the display loop 5 times?
from fuse.
My problem is that many more results get computed. My problem is not about displaying the results.
from fuse.
My understanding of the Bitap algorithm is that it has to process every item to calculate a score for it. The sorting can only happen after this.
For example if you search for egg
on this list:
["rEfriGeratorG", "salad", "EGGplant"]
And then cancel the search after it reaches the second item, it will return refrigeratorG
as the best match, when if you let it finish, eggplant
obviously would have been better.
You could still add a feature that limits the amount of results it spits out, but that's just the same as doing:
var results = fuse.search("stuff");
for(var i = 0; i < results.length; i++) {
// do stuff to display result
if(i > 4) break;
}
from fuse.
No, you could make the sorting itself more efficient. What I wrote today (for a different purpose) can be used for this as well: hifo.
from fuse.
you can do a top-k sorting but I believe most of the time is spent computing score. As AtmoEntity pointed out there's no way out of scoring everything to guarantee showing the best result.
from fuse.
Related Issues (20)
- Order of matching characters HOT 2
- Exclusion pattern not working in extended search HOT 3
- Fuse Bundle size issue HOT 3
- Would like to add more positioning information to `includeMatches` HOT 1
- Exact matching not working HOT 4
- Cannot find 'Syrup' with 'srp' HOT 1
- How to return actual characters matched HOT 1
- Deno docs are outdated HOT 1
- Dark mode in the docs HOT 1
- How to set prioritize exact matches when using dynamic weights for object property based search? HOT 1
- Add option to ignore diacritics HOT 4
- Unintuitive search results HOT 1
- can fuse.js support in langchain project,it may be good chain tool for ai llm models HOT 1
- Create a flag emptyGetsAll HOT 3
- Score appears to be unreliable for matches at start of string HOT 2
- Question, or bug on live demo page HOT 2
- How Fuse match is different from diff-match-patch HOT 1
- How can I use this module in chrome extension? HOT 1
- Incorrect indices of matched characters HOT 2
- Logical query with pattern without key HOT 2
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 fuse.