diff --git a/packages/sanity/src/core/search/groq2024/createSearchQuery.ts b/packages/sanity/src/core/search/groq2024/createSearchQuery.ts index c08b1cfd3ad..8f2fc5edc3e 100644 --- a/packages/sanity/src/core/search/groq2024/createSearchQuery.ts +++ b/packages/sanity/src/core/search/groq2024/createSearchQuery.ts @@ -69,10 +69,12 @@ export function createSearchQuery( .map(({typeName, paths}) => paths.map((path) => ({...path, typeName}))) .flat() - const groupedSpecs = groupBy( - flattenedSpecs, - (entry) => `text::matchQuery(${entry.path}, $__query), ${entry.weight}`, - ) + const groupedSpecs = groupBy(flattenedSpecs, (entry) => { + if (entry.weight === 0) { + return undefined + } + return `text::matchQuery(${entry.path}, $__query), ${entry.weight}` + }) const score = Object.entries(groupedSpecs) .map(([args, entries]) => {