Exploring Sanity? Take control of your content – watch the demo

Using the match function in GROQ for full and partial word queries

2 replies
Last updated: Dec 12, 2024
When using the
match
function in GROQ, the full word query shows more results than the shorter query; i.e. "optimization" vs "optim"??
The 2 queries here are identical, just with a different
query
parameter:
Dec 12, 2024, 3:55 AM
Match is looking for a full word. You can append
*
to your
$query
so that “optim” will match “optim”, “optimization”, “optimisation” and “optimusprime”
Dec 12, 2024, 2:31 PM
TY!
Dec 12, 2024, 5:08 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?