diff options
author | unknown <serg@serg.mysql.com> | 2001-12-11 20:40:32 +0100 |
---|---|---|
committer | unknown <serg@serg.mysql.com> | 2001-12-11 20:40:32 +0100 |
commit | 9152ef4b430c1ee0095a6e251030edf212cc9d20 (patch) | |
tree | 55d28ab1b4c1580aa4d85e8939f2dd498428dd36 | |
parent | 65feab359f6c72c98ef32ba6e458735b12533db4 (diff) | |
parent | f63d847e92071c04cff948fe05f2297915731c04 (diff) | |
download | mariadb-git-9152ef4b430c1ee0095a6e251030edf212cc9d20.tar.gz |
Merge work:/home/bk/mysql-4.0
into serg.mysql.com:/usr/home/serg/Abk/mysql-4.0
-rw-r--r-- | myisam/ft_boolean_search.c | 59 | ||||
-rw-r--r-- | myisam/ft_update.c | 7 | ||||
-rw-r--r-- | mysql-test/mysql-test-run.sh | 2 |
3 files changed, 37 insertions, 31 deletions
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index 4acce93e3ab..1b71337cc3b 100644 --- a/myisam/ft_boolean_search.c +++ b/myisam/ft_boolean_search.c @@ -359,10 +359,11 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record) float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) { - TREE ptree; - FT_WORD word; + FT_WORD word; FTB_WORD *ftbw; FTB_EXPR *ftbe; + FT_SEG_ITERATOR ftsi; + const byte *end; uint i; my_off_t docid=ftb->info->lastpos; @@ -393,33 +394,43 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) else if (ftb->state != SCAN) return -3.0; - bzero(&ptree, sizeof(ptree)); - if ((ftb->keynr==NO_SUCH_KEY) - ? ft_parse(& ptree, record, length) - : _mi_ft_parse(& ptree, ftb->info, ftb->keynr, record)) - return -4.0; + if (ftb->keynr==NO_SUCH_KEY) + _mi_ft_segiterator_dummy_init(record, length, &ftsi); + else + _mi_ft_segiterator_init(ftb->info, ftb->keynr, record, &ftsi); - for (i=1; i<=ftb->queue.elements; i++) + while (_mi_ft_segiterator(&ftsi)) { - ftbw=(FTB_WORD *)(ftb->queue.root[i]); - ftbw->docid=docid; - ptree.custom_arg=(void *)(ftbw->trunc); - word.pos=ftbw->word+1; - word.len=ftbw->len-1; - if (tree_search(& ptree, & word)) - { /* found! */ - _ftb_climb_the_tree(ftbw); - } - else - { /* not found! */ - if (ftbw->yesno>0 && ftbw->up->up==0) - { /* but this word MUST BE present in every document matched, - so we can stop the search right now */ - break; + if (!ftsi.pos) + continue; + + end=ftsi.pos+ftsi.len; + while (ft_simple_get_word((byte **)&ftsi.pos,(byte *)end,&word)) + { + uint a, b, c; + for (a=1, b=ftb->queue.elements+1, c=(a+b)/2; b-a>1; c=(a+b)/2) + { + ftbw=(FTB_WORD *)(ftb->queue.root[c]); + if (_mi_compare_text(default_charset_info, word.pos,word.len, + (uchar*) ftbw->word+1,ftbw->len-1,ftbw->trunc) >0) + b=c; + else + a=c; + } + for (; c; c--) + { + ftbw=(FTB_WORD *)(ftb->queue.root[c]); + if (_mi_compare_text(default_charset_info, word.pos,word.len, + (uchar*) ftbw->word+1,ftbw->len-1,ftbw->trunc)) + break; + if (ftbw->docid == docid) + continue; + ftbw->docid=docid; + _ftb_climb_the_tree(ftbw); } } } - delete_tree(& ptree); + ftbe=ftb->root; if (ftbe->docid==docid && ftbe->cur_weight>0 && ftbe->yesses>=ftbe->ythresh && !ftbe->nos) diff --git a/myisam/ft_update.c b/myisam/ft_update.c index e942b2d0975..01dd67b97fa 100644 --- a/myisam/ft_update.c +++ b/myisam/ft_update.c @@ -55,12 +55,9 @@ void _mi_ft_segiterator_dummy_init(const byte *record, uint len, uint _mi_ft_segiterator(register FT_SEG_ITERATOR *ftsi) { - if(!ftsi->num) - return 0; - if (!ftsi->seg) - return 1; + if (!ftsi->num) return 0; else ftsi->num--; + if (!ftsi->seg) return 1; else ftsi->seg--; - ftsi->seg--; ftsi->num--; if (ftsi->seg->null_bit && (ftsi->rec[ftsi->seg->null_pos] & ftsi->seg->null_bit)) { diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 13548be834c..562f4d6f23b 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -226,8 +226,6 @@ while test $# -gt 0; do $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --gdb option" fi DO_GDB=1 - # We must use manager, as things doesn't work on Linux without it - USE_MANAGER=1 USE_RUNNING_SERVER="" ;; --client-gdb ) |