strapi-plugin-fuzzy-search
strapi-plugin-fuzzy-search copied to clipboard
Fuzzy return data is in a different structure to strapi rest query data
Hi,
There is inconsistencies in your data response vs strapi rest api data response which is creating an anti-pattern.
When populating on fuzzy search we get back results like this:
[
{
"id": 4,
"name": "YurMart",
"banner": { // populated field
"id": 79,
"url": "https://ik.imagekit.io/cbs/ticketland/dev/crowd.jpg_FCCgK-CSL.png",
"type": "image"
}
}
]
But in strapi rest api the root and populated results are nested in "data" and "attributes" properties:
[
{
"id": 4,
"attributes": { // nested in attributes
"name": "YurMart",
"banner": { // rest api populated field
"data": {
"id": 79,
"attributes": {
"url": "https://ik.imagekit.io/cbs/ticketland/dev/crowd.jpg_FCCgK-CSL.png",
"type": "image"
}
}
}
}
}
]
I tried to ditch the initial strapi rest api query for fuzzy search just to return some initial data for page load but you cannot use fuzzy search without passing a search query.
What do you recommend?
I can also see in your docs that graphql fuzzy search returns the data correctly. So it is just the rest portion of it.
@gregg-cbs Thanks for bringing this up. I'll include this in the next major version bump 🙂