diff options
author | serg@serg.mylan <> | 2003-10-23 15:21:06 +0200 |
---|---|---|
committer | serg@serg.mylan <> | 2003-10-23 15:21:06 +0200 |
commit | b820d2a3472cd4ce9c8b87c961a0f848e5990557 (patch) | |
tree | 2ce015b91940f6ae6e70f56ba571010c4c8eb3f0 /myisam/ft_parser.c | |
parent | df69309593b7e377d18d005147b485573f607f70 (diff) | |
download | mariadb-git-b820d2a3472cd4ce9c8b87c961a0f848e5990557.tar.gz |
query expansion for fulltext search
Diffstat (limited to 'myisam/ft_parser.c')
-rw-r--r-- | myisam/ft_parser.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/myisam/ft_parser.c b/myisam/ft_parser.c index d6d1378bdae..8ab67aa9c6f 100644 --- a/myisam/ft_parser.c +++ b/myisam/ft_parser.c @@ -183,7 +183,7 @@ void ft_parse_init(TREE *wtree, CHARSET_INFO *cs) DBUG_VOID_RETURN; } -int ft_parse(TREE *wtree, byte *doc, int doclen) +int ft_parse(TREE *wtree, byte *doc, int doclen, my_bool with_alloc) { byte *end=doc+doclen; FT_WORD w; @@ -191,6 +191,15 @@ int ft_parse(TREE *wtree, byte *doc, int doclen) while (ft_simple_get_word(wtree->custom_arg, &doc,end,&w)) { + if (with_alloc) + { + byte *ptr; + /* allocating the data in the tree - to avoid mallocs and frees */ + DBUG_ASSERT(wtree->with_delete==0); + ptr=(byte *)alloc_root(& wtree->mem_root,w.len); + memcpy(ptr, w.pos, w.len); + w.pos=ptr; + } if (!tree_insert(wtree, &w, 0, wtree->custom_arg)) goto err; } |