Fuse: Add an option to return the raw search data

Created on 5 Feb 2021  路  4Comments  路  Source: krisk/Fuse

Description

I'm not sure if I'm missing something, but I would like Fuse to return the search objects for me without refIndex and the item labeling. Right now I have to loop one more time after having the search results, to have my objects again.

Describe the solution you'd like

What I have is this response:

[
  {
    "item": {
      "title": "Right Ho Jeeves",
      "author": "P.D. Mans",
      "tags": ["fiction", "war"]
    },
    "refIndex": 1
  },
  {
    "item": {
      "title": "Old Man's War fiction",
      "author": "John X",
      "tags": ["war"]
    },
    "refIndex": 0
  }
]

What I would like is this response:

[
  {
    "title": "Right Ho Jeeves",
    "author": "P.D. Mans",
    "tags": ["fiction", "war"]
  },
  {
    "title": "Old Man's War fiction",
    "author": "John X",
    "tags": ["war"]
  }
]

It would be useful when the score/refIndex are not needed.

Describe alternatives you've considered

I looked at the available options but none seem to solve this. The current workaround is to loop through and 'restore' the search results, but it's more complexity added for no reason.

Stale feature

Most helpful comment

I'd be willing to add this feature if the maintainers are interested in merging this.

All 4 comments

I'd be willing to add this feature if the maintainers are interested in merging this.

I'm curious if this is that useful to you since all that's needed is .map(r => r.item) on the results

True. I think it would be nice to have the option to get the raw values, though. It would decrease the loading time a little bit with larger amounts of data, and it doesn't seem to have any drawbacks.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

krisk picture krisk  路  4Comments

vexa picture vexa  路  4Comments

lxynox picture lxynox  路  3Comments

imanjra picture imanjra  路  3Comments

danielfdickinson picture danielfdickinson  路  4Comments