v.19.14New Feature
Function Hastoken(haystack, Token), Hastokencaseinsensitive(haystack, Token) to Check If Given Token Is in Haystack
FunctionhasToken(haystack, token),hasTokenCaseInsensitive(haystack, token)to check if given token is in haystack. Token is a maximal length substring between two non alphanumeric ASCII characters (or boundaries of haystack). Token must be a constant string. Supported by tokenbf_v1 index specialization. #6596, #6662 (Vasily Nemkov)
Why it matters
These functions allow efficient and precise detection of exact token occurrences within a string, especially useful for searching within text data where tokens are separated by punctuation or spaces. Leveraging thetokenbf_v1 index specialization significantly improves query performance by utilizing an index optimized for token-based lookups.How to use it
UsehasToken(haystack, token) or hasTokenCaseInsensitive(haystack, token) in SELECT statements or WHERE clauses to check for the presence of tokens inside string columns. Ensure that the tokenbf_v1 index is created on the target column to benefit from index acceleration. The token argument must be specified as a constant string literal.