like/ilike/~ (documented on the String functions page) when you need multi-needle, token-aware, or similarity-based matching.
hasToken
Checks whetherhaystack contains token as a whole token. A token is a maximal run of alphanumeric characters, so the token must be surrounded by non-alphanumeric delimiters to match (an underscore acts as a separator). token must be a constant string.
Syntax
haystack— the string to search within.token— the constant token to look for, delimited by non-alphanumeric characters.
UInt8:1if the token is present, otherwise0.
Find users whose bio contains the word as a token
hasTokenCaseInsensitive
Case-insensitive variant ofhasToken. Checks whether haystack contains token as a whole token, ignoring case. token must be a constant string.
Syntax
haystack— the string to search within.token— the constant token to look for, matched case-insensitively.
UInt8:1if the token is present regardless of case, otherwise0.
Match as a token in the bio
multiSearchAny
Checks whetherhaystack contains at least one of the supplied needles as a literal substring (case-sensitive).
Syntax
haystack— the string to search within.[needle1, needle2, ...]— an array of literal substrings to look for.
UInt8:1if any needle is found as a substring, otherwise0.
Match bios mentioning any leadership
multiSearchAnyCaseInsensitive
Case-insensitive variant ofmultiSearchAny. Checks whether haystack contains at least one of the supplied needles as a literal substring, ignoring case.
Syntax
haystack— the string to search within.[needle1, needle2, ...]— an array of literal substrings, matched case-insensitively.
UInt8:1if any needle is found regardless of case, otherwise0.
Match bios mentioning a leadership in any casing
multiMatchAny
Checks whetherhaystack matches at least one of the supplied regular expressions. Patterns use RE2 syntax; common patterns behave the same as PostgreSQL POSIX ERE, but exotic POSIX-only constructs may diverge.
Syntax
haystack— the string to search within.[pattern1, pattern2, ...]— an array of RE2 regular expression patterns.
UInt8:1if any pattern matches, otherwise0.
Match users on a Gmail or Yahoo email domain
hasSubsequence
Checks whetherneedle appears as a subsequence of haystack — its characters occur in order, but not necessarily contiguously (ClickHouse only).
Syntax
haystack— the string to search within.needle— the string whose characters must appear in order withinhaystack.
UInt8:1ifneedleis a subsequence ofhaystack, otherwise0.
Match emails whose local part contains the ordered letters
ngramSearch
Computes a non-symmetric 4-gram similarity ratio ofneedle within haystack. Higher values indicate that more of needle is present, making it useful for ranking fuzzy matches (ClickHouse only).
Syntax
haystack— the string to search within.needle— the string to look for.
Float32in the range[0, 1]. Values closer to1indicate thatneedleis more present inhaystack.
Rank bios by how strongly they resemble
ngramDistance
Computes the 4-gram edit distance betweenhaystack and needle, based on the symmetric difference of their n-gram multisets. Useful for fuzzy matching and typo tolerance (ClickHouse only).
Syntax
haystack— the string to compare.needle— the string to compare against.
Float32in the range[0, 1]. A value of0means the strings are identical; smaller values indicate greater similarity.
Find bios that are a close fuzzy match to