doris会支持es 的mulit_match这种功能吗

Viewed 37

表结构 CREATE TABLE dwd_mz_companyinformation_base (
id bigint NULL COMMENT 'id',
name varchar(255) NULL COMMENT '公司名称',
type varchar(255) NULL COMMENT '公司类型1、有限责任公司;2、股份有限公司;3、合伙企业;4、个人独资企业;5、农民专业合作社',
address varchar(255) NULL COMMENT '公司地址',
company_profile text NULL COMMENT '公司简介',
type_label varchar(255) NULL COMMENT '公司类型',
code_label varchar(255) NULL COMMENT '区划名称',
parent_code_label varchar(255) NULL COMMENT '父区划名称',
last_update datetime(6) NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '最后更新时间',
INDEX inv3 (company_profile) USING INVERTED PROPERTIES("support_phrase" = "true", "parser" = "chinese", "lower_case" = "true", "parser_mode" = "fine_grained") COMMENT '分词索引'
) ENGINE=OLAP
UNIQUE KEY(id)
COMMENT '企业信息明细表'
DISTRIBUTED BY HASH(id) BUCKETS AUTO
PROPERTIES (
"replication_allocation" = "tag.location.default: 3",
"min_load_replica_num" = "1",
);

想实现查询多字符串在name,address,company_profile 多个字段进行分词检索。
目前只能通过这个语句实现select name,address,company_profile from dwd_mz_companyinformation_base
where multi_match_any(concat(name,' ',address,' ',company_profile), [ '新能源汽车', '河北','补贴'] )
order by address。但是没有分词效果,假如输入“汽车新能源”就无法用到分词的效果了。

2 Answers

目前已经了类似的函数,函数名:test_index_multi_match,可以试试看,还没上文档

按git上的样例 https://github.com/apache/doris/blob/master/regression-test/suites/inverted_index_p0/test_index_multi_match.groovy

select count() from ${indexTbName2} where multi_match(clientip, request, status, size, 'all', '2');
修改语句执行(版本doris 2.1.7)
select name,address,company_profile from dwd_mz_companyinformation_base
where multi_match(name,address,company_profile,'all', '新能源汽车' )

报错如下> 1105 - errCode = 2, detailMessage = (192.168.0.210)[CANCELLED]failed to initialize storage reader. tablet=15665585, res=[RUNTIME_ERROR]parameter query type incorrect: query_type = -1

0#  doris::vectorized::FunctionMultiMatch::eval_inverted_index(doris::vectorized::VExpr*, doris::segment_v2::FuncExprParams&, std::shared_ptr<roaring::Roaring>&) at /var/local/ldb-toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.h:187
1#  non-virtual thunk to doris::vectorized::FunctionMult