From: Date: January 25 2006 10:49am Subject: bk commit into 5.0-fulltext tree (svoj:1.2057) BUG#16722 List-Archive: http://lists.mysql.com/internals/33384 X-Bug: 16722 Message-Id: <20060125094923.40C9A10D0@april.pils.ru> Below is the list of changes that have just been committed into a local 5.0-fulltext repository of svoj. When svoj does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2057 06/01/25 13:49:17 svoj@april.(none) +2 -0 BUG#16722 - Fulltext: implicit limit for query word number (depends on length of the query) Remove implicit limit for query word number. mysql-test/r/fulltext.result 1.83 06/01/25 13:49:13 svoj@april.(none) +5 -5 Reoder results. myisam/ft_boolean_search.c 1.97 06/01/25 13:49:13 svoj@april.(none) +20 -13 Remove implicit limit for query word number. Instead compute number of elements and allocate exactly needed memory. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: svoj # Host: april.(none) # Root: /home/svoj/devel/mysql/CNET/mysql-5.0-cnet --- 1.82/mysql-test/r/fulltext.result 2005-11-26 23:22:50 +04:00 +++ 1.83/mysql-test/r/fulltext.result 2006-01-25 13:49:13 +04:00 @@ -182,13 +182,13 @@ insert t1 values ("aaa10 bbb20"), ("aaa20 bbb15"), ("aaa30 bbb10"); select * from t1 where match a against ("+aaa* +bbb*" in boolean mode); a -aaa10 bbb20 -aaa20 bbb15 aaa30 bbb10 +aaa20 bbb15 +aaa10 bbb20 select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode); a -aaa20 bbb15 aaa30 bbb10 +aaa20 bbb15 select * from t1 where match a against ("+aaa* +ccc*" in boolean mode); a select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode); @@ -196,12 +196,12 @@ aaa10 bbb20 select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode); a -aaa20 bbb15 aaa30 bbb10 +aaa20 bbb15 select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode); a -aaa20 bbb15 aaa30 bbb10 +aaa20 bbb15 drop table t1; CREATE TABLE t1 ( id int(11), --- 1.96/myisam/ft_boolean_search.c 2005-12-27 22:05:29 +04:00 +++ 1.97/myisam/ft_boolean_search.c 2006-01-25 13:49:13 +04:00 @@ -84,6 +84,7 @@ my_off_t docid[2]; /* for index search and for scan */ my_off_t key_root; MI_KEYDEF *keyinfo; + struct st_ftb_word *prev; float weight; uint ndepth; uint len; @@ -98,6 +99,7 @@ CHARSET_INFO *charset; FTB_EXPR *root; FTB_WORD **list; + FTB_WORD *last_word; MEM_ROOT mem_root; QUEUE queue; TREE no_dupes; @@ -176,7 +178,9 @@ memcpy(ftbw->word + 1, word, word_len); ftbw->word[0]= word_len; if (info->yesno > 0) ftbw->up->ythresh++; - queue_insert(&ftb_param->ftb->queue, (byte *)ftbw); + ftb_param->ftb->queue.max_elements++; + ftbw->prev= ftb_param->ftb->last_word; + ftb_param->ftb->last_word= ftbw; ftb_param->ftb->with_scan|= (info->trunc & FTB_FLAG_TRUNC); /* fall through */ case FT_TOKEN_STOPWORD: @@ -468,7 +472,7 @@ { FTB *ftb; FTB_EXPR *ftbe; - uint res; + FTB_WORD *ftbw; if (!(ftb=(FTB *)my_malloc(sizeof(FTB), MYF(MY_WME)))) return 0; @@ -481,19 +485,10 @@ ftb->with_scan=0; ftb->lastpos=HA_OFFSET_ERROR; bzero(& ftb->no_dupes, sizeof(TREE)); + ftb->last_word= 0; init_alloc_root(&ftb->mem_root, 1024, 1024); - - /* - Hack: instead of init_queue, we'll use reinit queue to be able - to alloc queue with alloc_root() - */ - res=ftb->queue.max_elements=1+query_len/2; - if (!(ftb->queue.root= - (byte **)alloc_root(&ftb->mem_root, (res+1)*sizeof(void*)))) - goto err; - reinit_queue(& ftb->queue, res, 0, 0, - (int (*)(void*,byte*,byte*))FTB_WORD_cmp, 0); + ftb->queue.max_elements= 0; if (!(ftbe=(FTB_EXPR *)alloc_root(&ftb->mem_root, sizeof(FTB_EXPR)))) goto err; ftbe->weight=1; @@ -508,6 +503,18 @@ _ftb_parse_query(ftb, query, query_len, keynr == NO_SUCH_KEY ? &ft_default_parser : info->s->keyinfo[keynr].parser); + /* + Hack: instead of init_queue, we'll use reinit queue to be able + to alloc queue with alloc_root() + */ + if (! (ftb->queue.root= (byte **)alloc_root(&ftb->mem_root, + (ftb->queue.max_elements + 1) * + sizeof(void *)))) + goto err; + reinit_queue(&ftb->queue, ftb->queue.max_elements, 0, 0, + (int (*)(void*, byte*, byte*))FTB_WORD_cmp, 0); + for (ftbw= ftb->last_word; ftbw; ftbw= ftbw->prev) + queue_insert(&ftb->queue, (byte *)ftbw); ftb->list=(FTB_WORD **)alloc_root(&ftb->mem_root, sizeof(FTB_WORD *)*ftb->queue.elements); memcpy(ftb->list, ftb->queue.root+1, sizeof(FTB_WORD *)*ftb->queue.elements);