v.19.5New Features

Multisearchfirstposition Function Was Added

multiSearchFirstPosition function was added. #4780 (Danila Kutenin)
multiSearchFirstPosition function added.

Why it matters

The multiSearchFirstPosition function provides a way to efficiently find the first occurrence position of any of multiple search strings within a target string. This is useful for users who need to perform multi-pattern searching in a single pass, improving query expressiveness and potentially performance when dealing with multiple search terms.

How to use it

Use the multiSearchFirstPosition function by passing the target string as the first argument and an array of search strings as the second argument. The function returns the position of the first occurrence of any of the provided search strings within the target string.

Example:
SELECT multiSearchFirstPosition('ClickHouse is great', ['house', 'great'])

This query will return the position of the first occurrence of either 'house' or 'great' in the given string.