mirror of
https://github.com/MariaDB/server.git
synced 2026-05-09 16:44:29 +02:00
Bug #31228694 FTS QUERY WITH LIMIT HIT AN ASSERT
Problem: 1. The server terminates abnormally when phrase search doesn't filter out doc_ids correctly. This problem has been fixed in bug 2. Wrong query result: It's a regression from the bug #22709692 fix. This fix optimize full-text search query with limit clause. when FTS expression involves only union operation, we fetch only number of doc_ids specified with the limit clause. Fulltext phrase search is not an union operation and we consider phrase search with plugin parser a union operation. In phrase search with limit clause, we fetch limited doc_ids for each token and if any of the selected doc_id does not contain all tokens in correct order then we do not include that row_id in the result set. Therefore phrase search gets fewer number of rows than the qualified rows exist in the table. Fix: Added a condition that phrase search with plugin parser is not a union operation. RB: 24925 Reviewed by : Annamalai Gurusami <annamalai.gurusami@oracle.com> This is a cherry-pick of mysql/mysql-server@5549920b7a without a test case, because the test case depends on an n-gram tokenizer that will be missing from MariaDB until MDEV-10267 is added.
This commit is contained in:
parent
e391417f0f
commit
1ff8588c3f
1 changed files with 5 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2007, 2020, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2018, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
|
|
@ -557,8 +557,7 @@ fts_ast_node_check_union(
|
|||
fts_ast_node_t* node)
|
||||
{
|
||||
if (node->type == FTS_AST_LIST
|
||||
|| node->type == FTS_AST_SUBEXP_LIST
|
||||
|| node->type == FTS_AST_PARSER_PHRASE_LIST) {
|
||||
|| node->type == FTS_AST_SUBEXP_LIST) {
|
||||
|
||||
for (node = node->list.head; node; node = node->next) {
|
||||
if (!fts_ast_node_check_union(node)) {
|
||||
|
|
@ -566,6 +565,9 @@ fts_ast_node_check_union(
|
|||
}
|
||||
}
|
||||
|
||||
} else if (node->type == FTS_AST_PARSER_PHRASE_LIST) {
|
||||
/* Phrase search for plugin parser */
|
||||
return(false);
|
||||
} else if (node->type == FTS_AST_OPER
|
||||
&& (node->oper == FTS_IGNORE
|
||||
|| node->oper == FTS_EXIST)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue