summaryrefslogtreecommitdiff
path: root/storage/innobase/fts
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-03-07 08:02:33 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-03-07 08:02:33 +0200
commitaa4b2c15093312784ab3e21493d3093fd5bddbb1 (patch)
treedf334024af7ae992af183d5d205e62edd1e258b8 /storage/innobase/fts
parent32badae31f852e327c0cb9a1aabb936ccf13dd37 (diff)
parentf0cd70750345755fafaf095daaf7f861815f8600 (diff)
downloadmariadb-git-aa4b2c15093312784ab3e21493d3093fd5bddbb1.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'storage/innobase/fts')
-rw-r--r--storage/innobase/fts/fts0fts.cc9
-rw-r--r--storage/innobase/fts/fts0opt.cc23
2 files changed, 17 insertions, 15 deletions
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index d7695b7e9cc..d55cafa8ff2 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2018, MariaDB Corporation.
+Copyright (c) 2016, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -726,6 +726,7 @@ fts_reset_get_doc(
memset(get_doc, 0x0, sizeof(*get_doc));
get_doc->index_cache = ind_cache;
+ get_doc->cache = cache;
}
ut_ad(ib_vector_size(cache->get_docs)
@@ -4759,12 +4760,12 @@ fts_tokenize_document(
ut_a(!doc->tokens);
ut_a(doc->charset);
- doc->tokens = rbt_create_arg_cmp(
- sizeof(fts_token_t), innobase_fts_text_cmp, (void*) doc->charset);
+ doc->tokens = rbt_create_arg_cmp(sizeof(fts_token_t),
+ innobase_fts_text_cmp,
+ (void*) doc->charset);
if (parser != NULL) {
fts_tokenize_param_t fts_param;
-
fts_param.result_doc = (result != NULL) ? result : doc;
fts_param.add_pos = 0;
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index cf862cb8c6d..f91ebcbf2a6 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2018, MariaDB Corporation.
+Copyright (c) 2016, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -674,25 +674,27 @@ fts_fetch_index_words(
fts_zip_t* zip = static_cast<fts_zip_t*>(user_arg);
que_node_t* exp = sel_node->select_list;
dfield_t* dfield = que_node_get_val(exp);
- short len = static_cast<short>(dfield_get_len(dfield));
+
+ ut_a(dfield_get_len(dfield) <= FTS_MAX_WORD_LEN);
+
+ uint16 len = uint16(dfield_get_len(dfield));
void* data = dfield_get_data(dfield);
/* Skip the duplicate words. */
- if (zip->word.f_len == static_cast<ulint>(len)
- && !memcmp(zip->word.f_str, data, zip->word.f_len)) {
-
+ if (zip->word.f_len == len && !memcmp(zip->word.f_str, data, len)) {
return(TRUE);
}
- ut_a(len <= FTS_MAX_WORD_LEN);
-
- zip->word.f_len = ulint(len);
- memcpy(zip->word.f_str, data, zip->word.f_len);
+ memcpy(zip->word.f_str, data, len);
+ zip->word.f_len = len;
ut_a(zip->zp->avail_in == 0);
ut_a(zip->zp->next_in == NULL);
/* The string is prefixed by len. */
+ /* FIXME: This is not byte order agnostic (InnoDB data files
+ with FULLTEXT INDEX are not portable between little-endian and
+ big-endian systems!) */
zip->zp->next_in = reinterpret_cast<byte*>(&len);
zip->zp->avail_in = sizeof(len);
@@ -720,14 +722,13 @@ fts_fetch_index_words(
ut_a(len <= FTS_MAX_WORD_LEN);
len = 0;
}
- break;
+ continue;
case Z_STREAM_END:
case Z_BUF_ERROR:
case Z_STREAM_ERROR:
default:
ut_error;
- break;
}
}