summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2009-04-30 19:41:43 +0500
committerSergey Vojtovich <svoj@sun.com>2009-04-30 19:41:43 +0500
commit6a43ad1d53afc0dab3370812b0f69ce376f24deb (patch)
tree1ae950a42e2b81a105b31542070d9fbc7bae9888 /storage
parent91199415a5c48a24818673701b47bfa3bfa1e43a (diff)
parent509a9cee1ca110f6186f25a9cc85889e0918fa13 (diff)
downloadmariadb-git-6a43ad1d53afc0dab3370812b0f69ce376f24deb.tar.gz
Merge to 5.1-bugteam.
Diffstat (limited to 'storage')
-rw-r--r--storage/myisam/ft_boolean_search.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c
index 66097864622..58363894cff 100644
--- a/storage/myisam/ft_boolean_search.c
+++ b/storage/myisam/ft_boolean_search.c
@@ -335,7 +335,23 @@ static int _ftb_no_dupes_cmp(void* not_used __attribute__((unused)),
return CMP_NUM((*((my_off_t*)a)), (*((my_off_t*)b)));
}
-/* returns 1 if the search was finished (must-word wasn't found) */
+/*
+ When performing prefix search (a word with truncation operator), we
+ must preserve original prefix to ensure that characters which may be
+ expanded/contracted do not break the prefix. This is done by storing
+ newly found key immediatly after the original word in ftbw->word
+ buffer.
+
+ ftbw->word= LENGTH WORD [ LENGTH1 WORD1 ] WEIGHT REFERENCE
+ LENGTH - 1 byte, length of the WORD
+ WORD - LENGTH bytes, the word itself
+ LENGTH1 - 1 byte, length of the WORD1, present in case of prefix search
+ WORD1 - LENGTH bytes, the word itself, present in case of prefix search
+ WEIGHT - 4 bytes (HA_FT_WLEN), either weight or number of subkeys
+ REFERENCE - rec_reflength bytes, pointer to the record
+
+ returns 1 if the search was finished (must-word wasn't found)
+*/
static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
{
int r;
@@ -369,7 +385,8 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
if (ftbw->docid[0] < max_docid)
{
sflag|= SEARCH_SAME;
- _mi_dpointer(info, (uchar *)(ftbw->word + ftbw->len + HA_FT_WLEN),
+ _mi_dpointer(info, (uchar*) (lastkey_buf + HA_FT_WLEN +
+ (ftbw->off ? 0 : lastkey_buf[0] + 1)),
max_docid);
}
r=_mi_search(info, ftbw->keyinfo, (uchar*) lastkey_buf,