Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[RFC] Score per match indices

See original GitHub issue


A score for each match indices pair would be helpful. A really long piece of text could have many matches, but only a few close ones. For example, a search engine application might want to display and highlight a snippet of the matched text for the user, but if the text is very large and there are many matches it is impossible to decide which snippet to display.

Describe the solution you’d like

An additional array property on Fuse.FuseResultMatch, called indicesScores. The length of the array would be the same as the indices array, each value would be a score of how closely the text in that index pair matched. It would then be possible to determine the best index pair match out of the indices array. For example, consider the following match result:

  indices: [
    [2, 5],
    [100, 104],
    [400, 410],
  indicesScores: [

This would indicate that the indices pair at index 1 (so [100, 104]) had the strongest match, and hence the snippet of text at that location could be displayed and highlighted.

Describe alternatives you’ve considered

My current implementation just chooses first matched indices pair to display, which sometimes ends up looking a little funny. A possible workaround would be to take each indices pair and run that substring through Fuse again to see their individual scores, but that sounds like a lot of unneeded reptition.

Love the library, thanks so much for all your amazing work! ❤️

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

Dragoncallcommented, Dec 26, 2020

This would indeed be a great feature, as currently finding the good matches is quite impossible. In my application (showing where a query matches a description) there are a lot of single letters returned. Would it be possible to add a native implementation? @krisk

gaurav21rcommented, Nov 24, 2022

@krisk This seems to be marked completed, is there any way to find the score of each index?

Perhaps an alternate and more viable option would be to turn on a boolean value like say showAllMatchedIndices. The score property is calculated as the minimum for a particular term across all the Indices. As @KevinShiCA mentions, the score is a value of relevancy and an Indice Difference need not corelate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC 2652: MIME Object Definitions for the Common Indexing ...
Two CIP DSI's are considered to match if both conform to the above rules and every number matches. 2.1.3. Base-URI CIP index objects...
Read more >
(PDF) Performance Indicators Related to Points Scoring and ...
The aim of this study was to characterize team performance indicators in international rugby sevens and quantify their relationship with a ...
Read more >
Sieve Email Filtering: Date and Index Extensions RFC 5260
12 Freed Standards Track [Page 1] RFC 5260 Sieve Date and Index Extensions ... The "date" extension provides a new date test to...
Read more >
Performance Indicators in Rugby Union
Scoring Indicators : · Total points scored in WWC 2011 · Points scored per game · Points scored agains Tier A teams ·...
Read more >
[RFC] Ability to index multiple vector points per document
With the growing interest in approximate nearest neighbor search with Vespa, there has also been increased demand for the ability to index ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found