krisk / Fuse

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

Provide `key` in matching object when using query logical operators #673

Closed bernatesquirol closed 1 year ago

bernatesquirol commented 2 years ago

Description

If the query provided is using query logical operators, it would be nice that the attribute key is also included in the matching object (like it is when we don't use logical operators), in order to identify which of the conditions are found for a given match. { $or: [{ "brand.name": query }, { "name": query }] }

Describe the solution you'd like

The desired solution is having the key in each match object. { $or: [{ "brand.name": query }, { "name": query }] } I get that the same key could be repeated in the logical operations { $or: [{ "name": '=query' }, { "name": '^query' }] } but it would be fine not knowing which of those "two" are matched

Describe alternatives you've considered

The alternative is creating several intances of the fuse search with each one key, in order to stablish which match comes from where.

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