]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix URL generation in headline. Only tag lexeme will be replaced by space.
authorTeodor Sigaev <teodor@sigaev.ru>
Thu, 15 Jan 2009 18:30:10 +0000 (18:30 +0000)
committerTeodor Sigaev <teodor@sigaev.ru>
Thu, 15 Jan 2009 18:30:10 +0000 (18:30 +0000)
Per http://archives.postgresql.org/pgsql-bugs/2008-12/msg00013.php

contrib/tsearch2/ts_cfg.c
contrib/tsearch2/wparser_def.c

index 2a5fbbf5006225cc1ce04bc56a8c3866067da249..ccca8c5bf9f64085b6931fb11d1be3661f611662 100644 (file)
@@ -508,7 +508,7 @@ genhl(HLPRSTEXT * prs)
                                *ptr = ' ';
                                ptr++;
                        }
-                       else
+                       else if (!wrd->skip)
                        {
                                if (wrd->selected)
                                {
index 53199992c8e205c958f8b27edde1573784f682cd..29b3ca09b75eafd093503c098bca321c9acc4884 100644 (file)
@@ -77,8 +77,9 @@ prsd_end(PG_FUNCTION_ARGS)
 
 
 #define IDIGNORE(x) ( (x)==13 || (x)==14 || (x)==12 || (x)==23 )
-#define HLIDIGNORE(x) ( (x)==5 || (x)==13 || (x)==15 || (x)==16 || (x)==17 )
-#define NONWORDTOKEN(x) ( (x)==12 || HLIDIGNORE(x) )
+#define HLIDREPLACE(x)  ( (x)==13 )
+#define HLIDSKIP(x)     ( (x)==5 || (x)==15 || (x)==16 || (x)==17 )
+#define NONWORDTOKEN(x) ( (x)==12 || HLIDREPLACE(x) || HLIDSKIP(x) )
 #define NOENDTOKEN(x)  ( NONWORDTOKEN(x) || (x)==7 || (x)==8 || (x)==20 || (x)==21 || (x)==22 || IDIGNORE(x) )
 
 typedef struct
@@ -342,8 +343,10 @@ prsd_headline(PG_FUNCTION_ARGS)
                        prs->words[i].selected = 1;
                if (prs->words[i].repeated)
                        prs->words[i].skip = 1;
-               if (HLIDIGNORE(prs->words[i].type))
+               if (HLIDREPLACE(prs->words[i].type))
                        prs->words[i].replace = 1;
+               if (HLIDSKIP(prs->words[i].type))
+                       prs->words[i].skip = 1;
 
                prs->words[i].in = 1;
        }