2023-01-17 13:27:41 +00:00
|
|
|
#include "FunctionFactory.h"
|
2020-03-29 17:04:16 +00:00
|
|
|
#include "FunctionsStringSearch.h"
|
|
|
|
#include "HasTokenImpl.h"
|
|
|
|
|
2023-01-17 13:27:41 +00:00
|
|
|
#include <Common/Volnitsky.h>
|
2020-03-29 17:04:16 +00:00
|
|
|
|
2020-09-07 18:00:37 +00:00
|
|
|
namespace
|
|
|
|
{
|
2020-03-29 17:04:16 +00:00
|
|
|
struct NameHasToken
|
|
|
|
{
|
|
|
|
static constexpr auto name = "hasToken";
|
|
|
|
};
|
|
|
|
|
2023-01-23 22:27:48 +00:00
|
|
|
struct NameHasTokenOrNull
|
|
|
|
{
|
|
|
|
static constexpr auto name = "hasTokenOrNull";
|
|
|
|
};
|
|
|
|
|
2023-01-17 13:27:41 +00:00
|
|
|
using FunctionHasToken = DB::FunctionsStringSearch<DB::HasTokenImpl<NameHasToken, DB::VolnitskyCaseSensitiveToken, false>>;
|
2023-01-23 22:27:48 +00:00
|
|
|
using FunctionHasTokenOrNull = DB::
|
|
|
|
FunctionsStringSearch<DB::HasTokenImpl<NameHasTokenOrNull, DB::VolnitskyCaseSensitiveToken, false>, DB::ExecutionErrorPolicy::Null>;
|
2020-09-07 18:00:37 +00:00
|
|
|
}
|
|
|
|
|
2022-07-04 07:01:39 +00:00
|
|
|
REGISTER_FUNCTION(HasToken)
|
2020-03-29 17:04:16 +00:00
|
|
|
{
|
2023-01-17 15:12:06 +00:00
|
|
|
factory.registerFunction<FunctionHasToken>(
|
|
|
|
{"Performs lookup of needle in haystack using tokenbf_v1 index."}, DB::FunctionFactory::CaseSensitive);
|
|
|
|
|
|
|
|
factory.registerFunction<FunctionHasTokenOrNull>(
|
|
|
|
{"Performs lookup of needle in haystack using tokenbf_v1 index. Returns null if needle is ill-formed."},
|
|
|
|
DB::FunctionFactory::CaseSensitive);
|
2020-03-29 17:04:16 +00:00
|
|
|
}
|