Giter VIP home page Giter VIP logo

Comments (11)

bendesilva avatar bendesilva commented on May 23, 2024 1

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.

juice49 avatar juice49 commented on May 23, 2024 1

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.

ricokahler avatar ricokahler commented on May 23, 2024

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.

ricokahler avatar ricokahler commented on May 23, 2024

Can you provide a small schema that could help us reproduce this issue?

from sanity.

ricokahler avatar ricokahler commented on May 23, 2024

Hi @bendesilva did re-enabling the legacy search resolve your issue? Are you still experiencing this issue with the new search?

from sanity.

bendesilva avatar bendesilva commented on May 23, 2024

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.

juice49 avatar juice49 commented on May 23, 2024

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.

alexeygolev avatar alexeygolev commented on May 23, 2024

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.

bendesilva avatar bendesilva commented on May 23, 2024

@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.

juice49 avatar juice49 commented on May 23, 2024

@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.

bendesilva avatar bendesilva commented on May 23, 2024

@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:
Screenshot 2024-04-26 at 14 47 06

Typing in a term which you would expect to return a result:
Screenshot 2024-04-26 at 14 47 13

from sanity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.