From f23d2703d4e15d8967b0495f1a350a83768b4130 Mon Sep 17 00:00:00 2001 From: zzzxl1993 <474696115@qq.com> Date: Wed, 17 Jul 2024 16:52:43 +0800 Subject: [PATCH] [fix](inverted index) Corrected the issue of no_index_match failure caused by empty data. --- be/src/vec/functions/match.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/be/src/vec/functions/match.cpp b/be/src/vec/functions/match.cpp index eb4c1e3554bbbe..95e973ae612fed 100644 --- a/be/src/vec/functions/match.cpp +++ b/be/src/vec/functions/match.cpp @@ -366,7 +366,12 @@ Status FunctionMatchPhrasePrefix::execute_match( analyse_data_token(column_name, inverted_index_ctx, string_col, i, array_offsets, current_src_array_offset); - for (size_t j = 0; j < data_tokens.size() - query_tokens.size() + 1; j++) { + int32_t dis_count = data_tokens.size() - query_tokens.size(); + if (dis_count < 0) { + continue; + } + + for (size_t j = 0; j < dis_count + 1; j++) { if (data_tokens[j] == query_tokens[0] || query_tokens.size() == 1) { bool match = true; for (size_t k = 0; k < query_tokens.size(); k++) {