Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Troubleshooting search functionality issues in Sanity.io

13 replies
Last updated: Dec 6, 2021
I'm also experiencing an issue with the Search Functionality within Sanity where the search request is not returning anything. the
console
shows a 400 error alongside some sort of invalid character issue, wondering if anyone has encountered something similar & managed to fix it? 😄
Nov 30, 2021, 7:11 PM
Hi User. We’ve seen it once recently. It came down to the use of brackets to access array elements in a preview rather than our required dot notation . Unfortunately, it broke search but didn’t prevent building the studio. I would start by searching your code base for a preview using something like:

obj.body[0].children[0].text
and changing it to something (in this example) like:


obj.body.0.children.0.text
The best approach is probably to search for
preview: {
.
If that’s
not the case, please let us know.
Nov 30, 2021, 8:14 PM
Thanks, User. So would I look for that in the
select: {
part or
prepare()
or either?
Nov 30, 2021, 9:10 PM
In select.
Nov 30, 2021, 9:11 PM
Thanks, User. So would I look for that in the
select: {
part or
prepare()
or either?
Nov 30, 2021, 9:10 PM
In select.
Nov 30, 2021, 9:11 PM
Thanks, User. So would I look for that in the
select: {
part or
prepare()
or either?
Nov 30, 2021, 9:10 PM
In select.
Nov 30, 2021, 9:11 PM
Can't seem to find anything 😞Wonder would it have something to do with me having
"__experimental_spaces"
spaces enabled?
Nov 30, 2021, 9:33 PM
I don’t think that would cause this, but you never know.
Would you be willing to share your schema for us to take a look? The whole studio folder (minus node_modules) can be zipped and DMed.
Nov 30, 2021, 10:42 PM
Sure thing, I'll DM it to you now
Dec 1, 2021, 3:50 PM
Sure thing, I'll DM it to you now
Dec 1, 2021, 3:50 PM
Turned out to be a space in a
preview.select
value. I will log a feature request so that the errors returned are clearer (and help point the developer in the right direction).
Dec 6, 2021, 7:22 PM
Turned out to be a space in a
preview.select
value. I will log a feature request so that the errors returned are clearer (and help point the developer in the right direction).
Dec 6, 2021, 7:22 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?