summaryrefslogtreecommitdiff
path: root/contrib/tsearch2/dict_snowball.c
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2006-11-20 14:03:30 +0000
committerTeodor Sigaev <teodor@sigaev.ru>2006-11-20 14:03:30 +0000
commit419fe7cd1b2e658dfec236422308a21cab6c6c30 (patch)
tree0bf7b1e96e9734b9553f810c029dfe6d156a71d0 /contrib/tsearch2/dict_snowball.c
parent1a5c450f3024ac57cd6079186c71b3baf39e84eb (diff)
downloadpostgresql-419fe7cd1b2e658dfec236422308a21cab6c6c30.tar.gz
Fix bug http://archives.postgresql.org/pgsql-bugs/2006-10/msg00258.php.
Fix string's length calculation for recoding, fix strlower() to avoid wrong assumption about length of recoded string (was: recoded string is no greater that source, it may not true for multibyte encodings) Thanks to Thomas H. <me@alternize.com> and Magnus Hagander <mha@sollentuna.net>
Diffstat (limited to 'contrib/tsearch2/dict_snowball.c')
-rw-r--r--contrib/tsearch2/dict_snowball.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/contrib/tsearch2/dict_snowball.c b/contrib/tsearch2/dict_snowball.c
index f983ae8e13..6667744824 100644
--- a/contrib/tsearch2/dict_snowball.c
+++ b/contrib/tsearch2/dict_snowball.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/contrib/tsearch2/dict_snowball.c,v 1.12 2006/07/11 16:35:31 momjian Exp $ */
+/* $PostgreSQL: pgsql/contrib/tsearch2/dict_snowball.c,v 1.13 2006/11/20 14:03:30 teodor Exp $ */
/*
* example of Snowball dictionary
@@ -142,9 +142,11 @@ snb_lexize(PG_FUNCTION_ARGS)
{
DictSnowball *d = (DictSnowball *) PG_GETARG_POINTER(0);
char *in = (char *) PG_GETARG_POINTER(1);
- char *txt = pnstrdup(in, PG_GETARG_INT32(2));
+ char *utxt = pnstrdup(in, PG_GETARG_INT32(2));
TSLexeme *res = palloc(sizeof(TSLexeme) * 2);
-
+ char *txt = lowerstr(utxt);
+
+ pfree(utxt);
memset(res, 0, sizeof(TSLexeme) * 2);
if (*txt == '\0' || searchstoplist(&(d->stoplist), txt))
{