Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit41d17e0

Browse files
committed
Fix URL generation in headline. Only tag lexeme will be replaced by space.
Perhttp://archives.postgresql.org/pgsql-bugs/2008-12/msg00013.php
1 parent8fd07a3 commit41d17e0

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

‎src/backend/tsearch/ts_parse.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/tsearch/ts_parse.c,v 1.10 2009/01/01 17:23:48 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/tsearch/ts_parse.c,v 1.11 2009/01/15 16:33:59 teodor Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -625,7 +625,7 @@ generateHeadline(HeadlineParsedText *prs)
625625
*ptr=' ';
626626
ptr++;
627627
}
628-
else
628+
elseif (!wrd->skip)
629629
{
630630
if (wrd->selected)
631631
{

‎src/backend/tsearch/wparser_def.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.19 2009/01/15 16:33:28 teodor Exp $
10+
* $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.20 2009/01/15 16:33:59 teodor Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1587,10 +1587,11 @@ prsd_end(PG_FUNCTION_ARGS)
15871587
#defineCOMPLEXTOKEN(x) ( (x)==URL_T || (x)==NUMHWORD || (x)==ASCIIHWORD || (x)==HWORD )
15881588
#defineENDPUNCTOKEN(x) ( (x)==SPACE )
15891589

1590-
#defineTS_IDIGNORE(x) ( (x)==TAG_T || (x)==PROTOCOL || (x)==SPACE || (x)==XMLENTITY )
1591-
#defineHLIDIGNORE(x) ( (x)==URL_T || (x)==TAG_T || (x)==NUMHWORD || (x)==ASCIIHWORD || (x)==HWORD )
1592-
#defineXMLHLIDIGNORE(x) ( (x)==URL_T || (x)==NUMHWORD || (x)==ASCIIHWORD || (x)==HWORD )
1593-
#defineNONWORDTOKEN(x) ( (x)==SPACE || HLIDIGNORE(x) )
1590+
#defineTS_IDIGNORE(x) ( (x)==TAG_T || (x)==PROTOCOL || (x)==SPACE || (x)==XMLENTITY )
1591+
#defineHLIDREPLACE(x) ( (x)==TAG_T )
1592+
#defineHLIDSKIP(x) ( (x)==URL_T || (x)==NUMHWORD || (x)==ASCIIHWORD || (x)==HWORD )
1593+
#defineXMLHLIDSKIP(x) ( (x)==URL_T || (x)==NUMHWORD || (x)==ASCIIHWORD || (x)==HWORD )
1594+
#defineNONWORDTOKEN(x) ( (x)==SPACE || HLIDREPLACE(x) || HLIDSKIP(x) )
15941595
#defineNOENDTOKEN(x)( NONWORDTOKEN(x) || (x)==SCIENTIFIC || (x)==VERSIONNUMBER || (x)==DECIMAL || (x)==SIGNEDINT || (x)==UNSIGNEDINT || TS_IDIGNORE(x) )
15951596

15961597
typedefstruct
@@ -1695,13 +1696,15 @@ mark_fragment(HeadlineParsedText *prs, int highlight, int startpos, int endpos)
16951696
prs->words[i].selected=1;
16961697
if (highlight==0)
16971698
{
1698-
if (HLIDIGNORE(prs->words[i].type))
1699+
if (HLIDREPLACE(prs->words[i].type))
16991700
prs->words[i].replace=1;
1701+
elseif (HLIDSKIP(prs->words[i].type) )
1702+
prs->words[i].skip=1;
17001703
}
17011704
else
17021705
{
1703-
if (XMLHLIDIGNORE(prs->words[i].type))
1704-
prs->words[i].replace=1;
1706+
if (XMLHLIDSKIP(prs->words[i].type))
1707+
prs->words[i].skip=1;
17051708
}
17061709

17071710
prs->words[i].in= (prs->words[i].repeated) ?0 :1;
@@ -2050,13 +2053,15 @@ mark_hl_words(HeadlineParsedText *prs, TSQuery query, int highlight,
20502053
prs->words[i].selected=1;
20512054
if (highlight==0)
20522055
{
2053-
if (HLIDIGNORE(prs->words[i].type))
2056+
if (HLIDREPLACE(prs->words[i].type))
20542057
prs->words[i].replace=1;
2058+
elseif (HLIDSKIP(prs->words[i].type) )
2059+
prs->words[i].skip=1;
20552060
}
20562061
else
20572062
{
2058-
if (XMLHLIDIGNORE(prs->words[i].type))
2059-
prs->words[i].replace=1;
2063+
if (XMLHLIDSKIP(prs->words[i].type))
2064+
prs->words[i].skip=1;
20602065
}
20612066

20622067
prs->words[i].in= (prs->words[i].repeated) ?0 :1;

‎src/include/tsearch/ts_public.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1998-2009, PostgreSQL Global Development Group
88
*
9-
* $PostgreSQL: pgsql/src/include/tsearch/ts_public.h,v 1.12 2009/01/01 17:24:01 momjian Exp $
9+
* $PostgreSQL: pgsql/src/include/tsearch/ts_public.h,v 1.13 2009/01/15 16:33:59 teodor Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -38,7 +38,8 @@ typedef struct
3838
in:1,
3939
replace:1,
4040
repeated:1,
41-
unused:4,
41+
skip:1,
42+
unused:3,
4243
type:8,
4344
len:16;
4445
char*word;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp