Comments (5)
Could please elaborate? Thanks!
from fuse.
Sure.
Currently only Fuse itself is added to the globals but there are cases where the Searcher is useful in and of itself but there's no access to it. There are also occasions you might want to expose the actual score which currently gets eaten.
For example custom I've got a search function I think this could be a good fit with. It generates a score currently by a full text match on several fields with separate weightings (ie an item's relevance is 2x match(header) + 1x match(shortdescription) + 0.5x match(long description)). If Fuse's searcher was made public match could return the score rather than just 1 or 0.
from fuse.
Sounds good.
This should all be available with the latest release, as new options have been added. What you may be especially interested in is the ability to set the searchFn
. Right now it defaults to BitapSearcher
.
Additional options
// Fuse default options:
// Whether the score should be included in the result set.
// When <true>, each result in the list will be of the form:
// `{ item: ..., score: ... }`
includeScore: false,
// Whether to sort the result list, by score
shouldSort: true,
// The search function to use
// Note that the default search function ([[Function]]) must
// conform the following API:
//
// @param pattern The pattern string to search
// @param options The search option
// [[Function]].constructor = function(pattern, options)
//
// @param text: the string to search in for the pattern
// @return Object in the form of:
// - isMatch: boolean
// - score: Int
// [[Function]].prototype.search = function(text)
searchFn: BitapSearcher,
// The sort function to use
sortFn: function(a, b) {
return a.score - b.score;
}
from fuse.
As long as it exposes the BitapSearcher without needing to use the other parts of Fuse that sounds great. (I love what Fuse does but for some of my use cases that bit gets in the way).
from fuse.
Thanks, done a quick test and I can get the searcher via var bitap = new Fuse.defaultOptions.searchFn(pattern, options)
Noticed a small bug though that prevents you doing this with null or undefined options. I'll send a pull request.
from fuse.
Related Issues (20)
- Logical Query Operators with simple search string input HOT 3
- Ability to customize the extended search characters HOT 1
- Extended search not working with AND at all HOT 2
- Release 7.0.0 ? HOT 3
- Do I need to load all the documents again every time I load an existing index from a file? HOT 2
- Threshold isn't workiing as expected HOT 1
- Inverse match returns no result when matched fields are nullish HOT 2
- Not matching obvious matches? HOT 3
- Usage in deno HOT 1
- Fuse is not returning an exact match HOT 1
- Change defaults to `ignoreLocation: true` and `ignoreFieldNorm: true` HOT 2
- Recommended way to boost based on a different field HOT 1
- Add information about not commiting dist files HOT 2
- Exact matches on arrays of objects result in score higher than 1 HOT 3
- What is Breaking Changes "Extension Changed" in the 7.0.0 release? HOT 2
- Unclear how to do non-fuzzy search on a per-word basis HOT 3
- Fuzzy matching not working for typos HOT 4
- Fuzzy matching not working proper HOT 1
- Returned indexes are incorrect
- All indices return with threshold = 0 aren't a perfect match
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.