diff options
author | unknown <serg@serg.mylan> | 2003-10-14 16:19:13 +0200 |
---|---|---|
committer | unknown <serg@serg.mylan> | 2003-10-14 16:19:13 +0200 |
commit | f19fff63c246d96dd2014f68506485d8e6f64cd9 (patch) | |
tree | a2edbe68efe7bba2d565d91c3815736888388112 /myisam/ft_boolean_search.c | |
parent | 2e1115edc1b5899975c33b4367256ce650d3a0f4 (diff) | |
download | mariadb-git-f19fff63c246d96dd2014f68506485d8e6f64cd9.tar.gz |
"phrase search" should not match partial words (it should not match 'paraphrase searches')
myisam/ft_parser.c:
word definition moved to ftdefs.h
myisam/ftdefs.h:
word definition moved to ftdefs.h
Diffstat (limited to 'myisam/ft_boolean_search.c')
-rw-r--r-- | myisam/ft_boolean_search.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index dfefaf621c9..104acf02324 100644 --- a/myisam/ft_boolean_search.c +++ b/myisam/ft_boolean_search.c @@ -391,25 +391,34 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, } -/* returns 1 if str0 contain str1 */ +/* returns 1 if str0 ~= /\<str1\>/ */ static int _ftb_strstr(const byte *s0, const byte *e0, const byte *s1, const byte *e1, CHARSET_INFO *cs) { - const byte *p; + const byte *p0, *p1; + my_bool s_after, e_before; - while (s0 < e0) + s_after=true_word_char(cs, s1[0]); + e_before=true_word_char(cs, e1[-1]); + p0=s0; + + while (p0 < e0) { - while (s0 < e0 && cs->to_upper[(uint) (uchar) *s0++] != + while (p0 < e0 && cs->to_upper[(uint) (uchar) *p0++] != cs->to_upper[(uint) (uchar) *s1]) /* no-op */; - if (s0 >= e0) + if (p0 >= e0) return 0; - p=s1+1; - while (s0 < e0 && p < e1 && cs->to_upper[(uint) (uchar) *s0] == - cs->to_upper[(uint) (uchar) *p]) - s0++, p++; - if (p >= e1) + + if (s_after && p0-1 > s0 && true_word_char(cs, p0[-2])) + continue; + + p1=s1+1; + while (p0 < e0 && p1 < e1 && cs->to_upper[(uint) (uchar) *p0] == + cs->to_upper[(uint) (uchar) *p1]) + p0++, p1++; + if (p1 == e1 && (!e_before || p0 == e0 || !true_word_char(cs, p0[0]))) return 1; } return 0; |