krisk / Fuse

Lightweight fuzzy-search, in JavaScript
https://fusejs.io/
Apache License 2.0
18.14k stars 767 forks source link

Would like to add more positioning information to `includeMatches` #714

Closed EmptyDreams closed 1 year ago

EmptyDreams commented 1 year ago

My data structure is as follows:

{
    key0: ....,
    key1: ...,
    key2: [
        {
            value: [/* Here is the result after splitting the word. */],
            source: /* Here is the original string before splitting. */
        },
        ......
    }
}

My configuration is as follows:

const options = {
    ignoreLocation: true,
    useExtendedSearch: true,
    includeMatches: true,
    keys: [
        {
            name: 'key0',
            weight: 1
        },
        {
            name: 'key1',
            weight: 1
        },
        {
            name: 'key2.value',
            weight: 0.75
        }
    ]
}

Now, if I turn on the includeMatches option, I can only get the location of the searched string in key2.value, but I want to be able to get the location of the searched result in key2 in order for me to read source.

I wanted to split the search content in advance because the direct search results were not ideal, but the split was effective in improving accuracy.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 30 days