Comments (11)
Thanks @ricokahler, I'll look to test your solution and provide a small schema to reproduce the issue. Currently on a project which this came up as a blocking issue, so I have assigned titles in the interim to those affected documents. Will come back asap.
from sanity.
Hey @bendesilva. Thank you for providing those details! We've identified an issue causing documents to disappear from document lists and search if they contain no searchable paths. This is why your documents disappear when they only contain references, but appear if you add a string field.
We will fix this in the backend, so you shouldn't need to update Studio for things to begin working. We'll share an update here as soon as that fix is in place.
from sanity.
Hello @bendesilva!
This may be related to the new search strategy we just rolled out in v3.38.0. Can you try enabling the legacy search and seeing if that fixes your issue?
// sanity.config.ts
import { defineConfig } from 'sanity'
export default defineConfig({
name: 'default',
title: 'Test Studio',
search: {
enableLegacySearch: true,
},
// ...
})
from sanity.
Can you provide a small schema that could help us reproduce this issue?
from sanity.
Hi @bendesilva did re-enabling the legacy search resolve your issue? Are you still experiencing this issue with the new search?
from sanity.
Hi @ricokahler, thanks for your patience! Haven't had a chance to do further testing or put together a reduced schema until now.
I've replicated the issue I was experiencing, it's also present on 3.39.0, but as suggested the legacy search setting did indeed fix the issue and all documents appear within the document list. It seems that it only occurs when the preview component uses expanded references.
https://github.com/bendesilva/sanity-studio-test
For the reduced test case I have adapted the default blog schema provided when scaffolding a new studio. I have adapted the author
schema to have two fields; category
and name
, category
is a reference field to the category
document type and name
is a string field. The preview title uses category.title
and the subtitle uses name
. If you publish a document with the category
field set only, the document will not appear in the list, if you set both the category
reference and name
then it will appear.
Setting enableLegacySearch
to true
reveals all documents as expected.
For reference my original use case was for a colour palette document type, each document has a series of reference fields to predefined colour swatch documents (i.e. background, foreground, highlight). The preview component would generate a title from the colour swatch titles and values. In the end I just gave each swatch a title to get around this issue.
from sanity.
We've released a backend fix for this issue now. @bendesilva, please let us know if you experience any further issues, and I'm sorry for the trouble this caused you.
from sanity.
I had the same problem and the fix didn't fix it. But it might be something else. I checked my network tab to see the response from the search query and, although the matchScore
field for the document I'm searching for is the highest, it's somewhere in the middle of the results list in UI. So it seems like the search works correctly at the backend but the "Best match" sorting is not taking the rankingInfo into the account
from sanity.
@juice49 Thanks for the update, looks like it's fixed the issue of documents not appearing in lists or when selecting a reference, so that's great. Those documents aren't being surfaced in the global studio search, nor am I able to search for the document in a reference field (I can select it from the dropdown), but I'm assuming that's because the preview component for those documents are expanding a reference's title to use as its own, and the document itself doesn't have any indexable data.
from sanity.
@bendesilva Excellent! Thank you for confirming.
Those documents aren't being surfaced in the global studio search, nor am I able to search for the document in a reference field (I can select it from the dropdown), but I'm assuming that's because the preview component for those documents are expanding a reference's title to use as its own, and the document itself doesn't have any indexable data.
If I understand correctly, your document contains only references, and you're attempting to search for it based on a field that appears in one of those referenced document. I'm afraid that is not something supported either before or after the most recent search update.
from sanity.
@juice49 That's right, and this is really an aside to the now resolved issue. But, using the example studio I provided, the preview component title
property of a category
document uses the title of a referenced author
document. However when you have a reference field to a category
document (as the post
document type does), you can see those documents in the reference dropdown, but when searching for a term appearing in the preview, those documents aren't returned. I understand why this is, but the UX feels a bit jarring and could be confusing to some editors, as it feels as though the reference search input would be filtering the document list you'd already seen.
Selecting a document from a reference field:
Typing in a term which you would expect to return a result:
from sanity.
Related Issues (20)
- Typegen not reading `=> @` correctly. HOT 3
- Typegen result names are not customizable HOT 1
- Sanity npm package throws type error on build HOT 3
- Ability to order documents using an array value
- Hide schedule action in some documents
- Unable to upload images to block content type field on Safari
- Introduce Selective CLI Logging Suppression
- How can I restrict access to resources only through my domain? HOT 2
- TypeGen not generating union type for string array with list option
- can't use `npx @sanity/cli init --template shopify` with the next.js embedded studio option
- On >3.41.0 dragging blocks in PTE gives "Can't upload this file here" error HOT 1
- TypeGen generates Array<never> for query using "in" HOT 1
- TypeGen generates Array<never> for query using chained parent operator
- Hang introduced by #5269, (a0f93cb) (fix included) HOT 3
- Typegen: Can't generate types with conditional values in slice and ordering operations even when the it doesn't effect the type. HOT 1
- All Studio UI menus broken/empty in Dev HOT 1
- Both new and legacy search don't work with documents with a custom title field
- Desk tool crash: editOpsOf does not expect a draft id HOT 1
- throw new Error("'block' type is not defined in this schema (required).");
- Cannot Paste Into Block Content HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sanity.