Follow

What is the difference between the CONTAINS_ANY and IN CSDL Operators?

CONTAINS_ANY and IN are both CSDL operators that can take a list of strings as an argument, however function slightly differently.

The content of the target field is tokenized when using the contains_any operator, meaning that content that is surrounded by spaces or punctuation is broken up into 'words'. For example, if filtering on the value "cookie_crisp" using the contains_any operator, we actually split it out into three 'words': "cookie" + "_" + "crisp". As a result, content such as "dr_cookie_crisp" will match. This may be an unsuitable operator when filtering on username targets for this reason.

By contrast, the in operator will match exact words or phrases (separated by commas) to the entirety of an output field. In this case, a filter such as the following will only match a user with the screen name "cookie_crisp":

interaction.author.username in "cookie_crisp"

We have more information about how tokenization works on our Tokenization and the CSDL Engine documentation page. More information regarding operators can be found in the documentation for IN and CONTAINS_ANY.

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk