diff options
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/ft_boolean_search.c | 12 | ||||
-rw-r--r-- | myisam/ft_nlq_search.c | 13 |
2 files changed, 22 insertions, 3 deletions
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index 1d4bfee86a4..f6092921a02 100644 --- a/myisam/ft_boolean_search.c +++ b/myisam/ft_boolean_search.c @@ -221,6 +221,12 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) r=_mi_search(info, ftbw->keyinfo, (uchar*) ftbw->word+ftbw->off, USE_WHOLE_KEY, SEARCH_BIGGER, ftbw->key_root); } + + /* Skip rows inserted by concurrent insert */ + while (!r && info->lastpos >= info->state->data_file_length) + r= _mi_search_next(info, keyinfo, info->lastkey, info->lastkey_length, + SEARCH_BIGGER, keyroot); + if (!r && !ftbw->off) { r= mi_compare_text(ftb->charset, @@ -267,8 +273,10 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) subkeys=ft_sintXkorr(info->lastkey+off); if (subkeys<0) { - /* yep, going down, to the second-level tree */ - /* TODO here: subkey-based optimization */ + /* + yep, going down, to the second-level tree + TODO here: subkey-based optimization + */ ftbw->off=off; ftbw->key_root=info->lastpos; ftbw->keyinfo=& info->s->ft2_keyinfo; diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c index 03875abe7b0..b79bf8a2baa 100644 --- a/myisam/ft_nlq_search.c +++ b/myisam/ft_nlq_search.c @@ -88,7 +88,13 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) keylen-=HA_FT_WLEN; doc_cnt=0; - r=_mi_search(info, keyinfo, keybuff, keylen, SEARCH_FIND, key_root); + /* Skip rows inserted by current inserted */ + for (r=_mi_search(info, keyinfo, keybuff, keylen, SEARCH_FIND, key_root) + !r && info->lastpos >= info->state->data_file_length; + r= _mi_search_next(info, keyinfo, info->lastkey, + info->lastkey_length, SEARCH_BIGGER, key_root)) + ; + info->update|= HA_STATE_AKTIV; /* for _mi_test_if_changed() */ while (!r && gweight) @@ -151,6 +157,11 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) else r=_mi_search(info, keyinfo, info->lastkey, info->lastkey_length, SEARCH_BIGGER, key_root); + + while (!r && info->lastpos >= info->state->data_file_length) + r= _mi_search(info, keyinfo, info->lastkey, info->lastkey_length, + SEARCH_BIGGER, key_root); + } word->weight=gweight; |