Right-anchored string search

Is there a way to perform a partial search on a single word? For instance, if I have the value “840N” I’d like the searches “40N” or “840” to return the content. Right now the [matches] operator is left-anchored (would match on “840” but not “40N”.

1 Like

Hey @caslett!

Hm, that’s strange. It should work both ways, and we have exactly the same (right-anchored) example in code snippets: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/full-text-search-on-a-field/query-entries/console/curl.
Maybe you could provide me with the specific query? Did you curl or use specific SDK?

@caslett I think I confused you a bit, sorry for that!
So, I was wrong- it’s left-anchored search. I think the reason it works for code snippet in docs is because the query includes . in .com slice. That is probably parsed as a new string, and therefore it works.
As for workarounds, I think unfortunately, we don’t have a straightforward one at the moment. I was thinking about slicing strings, but that’s cumbersome. And it also depends on SDK you’re using.

Thanks for the response @andrey! I’m using the .NET SDK. Is it as simple as prepending/appending a “.” on any search string?