-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(core): various fixes and improvements to studio search [v2] #4704
Conversation
… _id from whole word score generation
…ons and weighting
…UNSTABLE_SEARCH_DEPTH environment variable
…isplay skipped paths in generated search specs
…d support for defining MAX_UNIQUE_ATTRIBUTES via env var
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…exclude _id from whole word score generation
1e14b70
to
1004aa7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really excellent work @robinpyon!
Left a few comments inline, nothing big, so good to merge from what I can tell.
if (childType.jsonType === 'string') { | ||
return [...acc, {path, weight: 1}] | ||
} | ||
if (isPortableTextArray(childType)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch - should we "forwardport" this to current?
Description
This PR brings a number of fixes and minor improvements to studio search in v2. Please refer to the internal slack thread for more context.
Search path generation:
SEARCH_DEPTH_LIMIT
) has increased significantly (now 15, up from 4)SEARCH_PATH_LIMIT
) generated per root-level object (defaults to 500)These changes help ensure that deeper fields are more easily searchable, whilst the path limit per object ensures a reasonable cap when dealing with recursive structures, preventing the client from hanging when generating these on studio initialisation.
Search query generation:
SEARCH_ATTR_LIMIT
) included in search queries (defaults to 1000).__experimental_search
paths are always included, regardless of the limit defined above_id
and_type
fields twice in object projections, also reducing response sizes slightlycreateSearchQuery
function (in addition to the existingcreateWeightedSearch
)Combined with the changes to search path generation, this should mean that type-constrained searches (e.g. filtering by document types) should be able to access much more deeply nested fields. In most 'regular' cases (i.e. studio schema without recursive / circular structures), users should be able to search beyond the original 4 level limit we had before, even when searching across all document types.
Search weighting / scoring:
stories
included in eachWeightedHit
now also includesindices
– a value which indicates any matching array indices, where applicable. Custom search implementations can use this to visually surface additional context.__experimental_search
New unstable environment variables (which override the above):
SANITY_STUDIO_UNSTABLE_SEARCH_ATTR_LIMIT
SANITY_STUDIO_UNSTABLE_SEARCH_DEPTH_LIMIT
SANITY_STUDIO_UNSTABLE_SEARCH_PATH_LIMIT
What to review
fo
,tes
on the test studio) – these should now be ordered much more intuitivelyNotes for release