diff options
author | unknown <serg@infomag.ape.relarn.ru> | 2000-08-28 17:43:58 +0400 |
---|---|---|
committer | unknown <serg@infomag.ape.relarn.ru> | 2000-08-28 17:43:58 +0400 |
commit | ca04c0eca770ebc50bb336f3ec3d66eb2fe46b58 (patch) | |
tree | 485c3b99b43fae8c2b58b7a5ab72b383265423d2 /sql/item_func.cc | |
parent | fe26eac2198e79de6e23c17c5033a5c7bc8e1d41 (diff) | |
download | mariadb-git-ca04c0eca770ebc50bb336f3ec3d66eb2fe46b58.tar.gz |
ft_optimization: identical queries merging. collection -> fulltext. Bugs fixed.
**************** !!! NOTE EVERYBODY: SYNTAX CHANGED !!! ********************
There's no COLLECTIONs now, full-text indexes can be created via the word
FULLTEXT, which should be used like UNIQUE.
myisam/mi_check.c:
comments added
sql/lex.h:
COLLECTION -> FULLTEXT
sql/item_func.h:
ft-optimization: identical queries merging
sql/sql_select.cc:
ft-optimization
sql/item_func.cc:
ft-optimization: identical queries merging
sql/sql_base.cc:
ft_optimization: identical queries merging
sql/sql_yacc.yy:
COLLECTION -> FULLTEXT
myisam/ft_search.c:
info->lastpot dealing
Docs/manual.texi:
COLLECTION -> FULLTEXT
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 69 |
1 files changed, 50 insertions, 19 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 66e03e72f6b..65677690ed3 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1837,26 +1837,8 @@ err: double Item_func_match::val() { - my_off_t docid=table->file->row_position(); // HAVE to do it here... - if (first_call) - { - if (join_key=(table->file->get_index() == key && - (ft_handler=(FT_DOCLIST *)table->file->ft_handler))) - ; - else - { - /* join won't use this ft-key, but we must to init it anyway */ - String *ft_tmp=0; - char tmp1[FT_QUERY_MAXLEN]; - String tmp2(tmp1,sizeof(tmp1)); - - ft_tmp=key_item()->val_str(&tmp2); - ft_handler=(FT_DOCLIST *) - table->file->ft_init_ext(key, (byte*) ft_tmp->ptr(), ft_tmp->length()); - } - first_call=0; - } + init_search(); // Don't know how to return an error from val(), so NULL will be returned if ((null_value=(ft_handler==NULL))) @@ -1873,6 +1855,7 @@ double Item_func_match::val() int a,b,c; FT_DOC *docs=ft_handler->doc; + my_off_t docid=table->file->row_position(); if ((null_value=(docid==HA_OFFSET_ERROR))) return 0.0; @@ -1893,6 +1876,36 @@ double Item_func_match::val() } } +void Item_func_match::init_search() +{ + if (!first_call) + return; + first_call=false; + + if (master) + { + master->init_search(); + ft_handler=master->ft_handler; + join_key=master->join_key; + return; + } + + if (join_key) + { + ft_handler=((FT_DOCLIST *)table->file->ft_handler); + return; + } + + /* join won't use this ft-key, but we must to init it anyway */ + String *ft_tmp=0; + char tmp1[FT_QUERY_MAXLEN]; + String tmp2(tmp1,sizeof(tmp1)); + + ft_tmp=key_item()->val_str(&tmp2); + ft_handler=(FT_DOCLIST *) + table->file->ft_init_ext(key, (byte*) ft_tmp->ptr(), ft_tmp->length()); +} + bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist) { List_iterator<Item> li(fields); @@ -1982,6 +1995,24 @@ bool Item_func_match::fix_index() this->key=max_key; first_call=1; maybe_null=1; + join_key=0; + + return 0; +} + +bool Item_func_match::eq(const Item *item) const +{ + if (item->type() != FUNC_ITEM) + return 0; + + if (func_name() != ((Item_func*)item)->func_name()) + return 0; + + Item_func_match *ifm=(Item_func_match*) item; + + if (key == ifm->key && table == ifm->table && + key_item()->eq(ifm->key_item())) + return 1; return 0; } |