When I have the option findAllMatches set to true, it lists out all the matches in the matches array.
For example, Searching "Apple"
Result in an array of 3 objects.
1. What is the refIndex for?
object1:
{item: {...}, refInfex: 72, matches: Array(2), score: 0.002}
object2:
{item: {...}, refInfex: 38, matches: Array(1), score: 0.0024}
object3:
{item: {...}, refInfex: 88, matches: Array(3), score: 0.003}
And if we expand to see the matches in one of the objects
2. What is the refIndex in match for?
matches: [
{indices: Array(1), value: "Apple", key: "name", refIndex: 0}
{indices: Array(1), value: "Apple pie", key: "product"}
]
3. Would it make more sense to provide score for each of the matches??
for example
matches: [
{indices: Array(1), value: "Apple", key: "fruit", refIndex: 0, score: 0}
{indices: Array(1), value: "Apple pie", key: "product", score: 0.001}
]
that way we know that "fruit" key has the highest matching score.
...and is there a way to return to the results from version 2?
...and is there a way to return to the results from version 2?
what is version 2 referring to?
refIndex corresponds to the match's index in the original list (or nested array). For example, suppose you have the following list:
const list = [{
"name": "Two",
"tags": ["one", "two", "three"]
}]
And you search "name", and "tags", and you search for "two", Fuse would return the index of the item in list (refIndex:0), as well as the index of the matched tag in the nested array (refIndex:1).
refIndexcorresponds to the match's index in the original list (or nested array). For example, suppose you have the following list:const list = [{ "name": "Two", "tags": ["one", "two", "three"] }]And you search
"name", and"tags", and you search for"two", Fuse would return the index of the item inlist(refIndex:0), as well as the index of the matched tag in the nested array (refIndex:1).
I see that makes sense! Thank you!
Most helpful comment
refIndexcorresponds to the match's index in the original list (or nested array). For example, suppose you have the following list:And you search
"name", and"tags", and you search for"two", Fuse would return the index of the item inlist(refIndex:0), as well as the index of the matched tag in the nested array (refIndex:1).