Full text search not matching short words

Hi there

We are currently using the rest api to query specific records from our "promotions" type.
we have a field called receiver_country which is just a text field. We use this to list the countries this promotion applies to in the following way: be, us, fr, de. (comma separated list of short country codes).
However when we try to query the a promotion with the full text search functionality it doesn't quite work the way we expect.
Reading other posts here, it looks like short words might be ignored because the fulltext search is optimized for seo search.

[fulltext(my.promotions.receiver_country, "be")] -> these short queries either return nothing or everything. Never the actual matching ones. If I try the same query on the name field with one or multiple words, it will actually match the records with that string in the name.

Is this expected and if so, how can we work around this?

Thanks in advance.

Hello @ops2

Welcome to the Prismic community, and thanks for reaching out to us.

This is an intended behavior or limitation of fulltext query. The fulltext search only works with full-word matches. For a better and more efficient search, we recommend using algolia.


Hi @Priyanka

Thanks for the quick reply. We do have a comma separated string like be, us, fr, de so shouldn't it match on the individual 2-character strings since they are "words" separated by a comma?
Could we bypass the limitation by splitting the strings with something else like just spaces or other characters?

Thanks again.

Hello @ops2

The fulltext search functionality in Prismic is a fuzzy search. It works sometime and sometime doesn't. We usually recommend implementing Algolia for robust search or partial keyword searches.