commercetoolssphere.io

How to use "Like" where predicate in commerce tools


I am using commerce tools and I want to fetch data for matching result.

For example: I need to fetch "keyword" by giving key only, same as we do by using like in SQL.

Has anyone know any such query predicate in commerce-tools ?

Thanks in advance :)


Solution

  • The commercetools query predicates do not support substring matches today (Feb 2019). You can do language aware full text search over Products and Categories which would match certain types of substrings (grammatical variations or parts of compound words in languages like german), but not the exact behaviour that you know of SQL LIKE '%key%'.

    It basically means you have to plan ahead relatively well in what form of data you need on a resource for your use cases. Or check whether there is an explicit feature for your use case that helps you out.