sanity-io / sanity

Sanity Studio – Rapidly configure content workspaces powered by structured content
https://www.sanity.io
MIT License
5.06k stars 410 forks source link

Ability to use a fully customisable search bar #7055

Open boris-felix opened 3 days ago

boris-felix commented 3 days ago

Is your feature request related to a problem? Please describe.

Issue: The overall search bar is not returning the search results required. This is blocking finding documents to review, and also blocks from removing duplicates we know of. Example: Typing (or pasting) Machine Single Arm Row returns the current fields

Screenshot 2024-07-02 at 15 32 56

Expected Result: We should have the expected search result showing as the first result. For example, Machine Single Arm Row should be showing, and should be first on this list.

Describe the solution you'd like We assume that the large amount of documents we have created is creating too much noise for the internal sanity studio search engine, and after a certain threshold, it is no longer able to return accurate results. We would like the option to swap this search for a custom search that would be fully customisable and that would then allow us to search document through an alternative search engine. Additionally, it would give the ability to filter and sort results in a way that would suit our usage better.

Additional context Here is what finally came up with by creating a custom input embedded inside the logo. With Css and a bit of javascript we were then able to add a toggle that would show / hide the main search and replace it with the custom input.

https://github.com/sanity-io/sanity/assets/736122/766dbda3-fef1-4589-8566-bb93333f549a

Credit to TautvydasDerzinskas

jordanl17 commented 3 days ago

Hello, thank you for raising this feature request.

Have you tried adding weighted search to your studio?
https://www.sanity.io/docs/studio-search-config

boris-felix commented 2 days ago

Hi Jordan.

We saw that feature in your documentation but this is not really suiting our needs. We may want to manipulate the search results in a more complex way that is possible with just changing the weight of some fields on the schema.

Additionally, the filtering and sorting options we require are quite important for our content editor so they can quickly find what they need.

SimeonGriggs commented 2 days ago

Are you still on Studio v2 or just an older version of v3?

The global search in newer Studio versions has the ability to add "facets" to the search, so you could select a specific instructor in your Studio, just like how the filter below could select author.

Screenshot 2024-07-03 at 13 09 16
jordanl17 commented 2 days ago

You could also try opting to our newer (and currently not widely released or recommended) Text Search API, by setting:

// ./sanity.config.ts|js

import {defineConfig} from 'sanity'

export default defineConfig({
  // ...rest of config
  search: {
    enableLegacySearch: false,
  }
})
boris-felix commented 1 day ago

Are you still on Studio v2 or just an older version of v3?

The global search in newer Studio versions has the ability to add "facets" to the search, so you could select a specific instructor in your Studio, just like how the filter below could select author.

Screenshot 2024-07-03 at 13 09 16

We are still on v2 but were planning to migrate to v3 later this summer. Good to know about this feature.

boris-felix commented 1 day ago

You could also try opting to our newer (and currently not widely released or recommended) Text Search API, by setting:

// ./sanity.config.ts|js

import {defineConfig} from 'sanity'

export default defineConfig({
  // ...rest of config
  search: {
    enableLegacySearch: false,
  }
})

What benefits brings the Text Search API exactly ?