summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2000-11-16 13:08:20 +0100
committerunknown <serg@serg.mysql.com>2000-11-16 13:08:20 +0100
commit8c9b5bfd0e48e0e83b24f8c30ba86cfeebf74964 (patch)
tree78286fce3647e11de973fb40582de2e038d755a2 /sql/item_func.cc
parent0d55a136bcc14b17d6f7eb6713b40a0ea2b2722a (diff)
downloadmariadb-git-8c9b5bfd0e48e0e83b24f8c30ba86cfeebf74964.tar.gz
item_func.cc bugfix - two fulltext indices were not working sometimes
sql/item_func.cc: bugfix - two fulltext indices were not working sometimes
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc41
1 files changed, 26 insertions, 15 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 47bc089b3e0..3d002e5c9d9 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1975,31 +1975,42 @@ bool Item_func_match::fix_index()
}
}
- uint max_cnt=0, max_key=0;
+ uint max_cnt=0, mkeys=0;
for (key=0 ; key<fts ; key++)
{
if (ft_cnt[key] > max_cnt)
{
- max_cnt=ft_cnt[key];
- max_key=ft_to_key[key];
+ mkeys=0;
+ max_cnt=ft_cnt[mkeys]=ft_cnt[key];
+ ft_to_key[mkeys]=ft_to_key[key];
+ continue;
+ }
+ if (ft_cnt[key] == max_cnt)
+ {
+ mkeys++;
+ ft_cnt[mkeys]=ft_cnt[key];
+ ft_to_key[mkeys]=ft_to_key[key];
+ continue;
}
}
- // for now, partial keys won't work. SerG
-
- if (max_cnt < fields.elements ||
- max_cnt < table->key_info[max_key].key_parts)
+ for (key=0 ; key<=mkeys ; key++)
{
- my_printf_error(ER_FT_MATCHING_KEY_NOT_FOUND,
- ER(ER_FT_MATCHING_KEY_NOT_FOUND),MYF(0));
- return 1;
- }
+ // for now, partial keys won't work. SerG
+ if (max_cnt < fields.elements ||
+ max_cnt < table->key_info[ft_to_key[key]].key_parts)
+ continue;
- this->key=max_key;
- maybe_null=1;
- join_key=0;
+ this->key=ft_to_key[key];
+ maybe_null=1;
+ join_key=0;
- return 0;
+ return 0;
+ }
+
+ my_printf_error(ER_FT_MATCHING_KEY_NOT_FOUND,
+ ER(ER_FT_MATCHING_KEY_NOT_FOUND),MYF(0));
+ return 1;
}
bool Item_func_match::eq(const Item *item) const