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

Commit8fd07a3

Browse files
committed
Fix generation too long headline with ShortWords.
Perhttp://archives.postgresql.org/pgsql-hackers/2008-09/msg01088.php
1 parentf8c8386 commit8fd07a3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎src/backend/tsearch/wparser_def.c

Lines changed: 5 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/wparser_def.c,v 1.18 2009/01/01 17:23:48 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.19 2009/01/15 16:33:28 teodor Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1921,6 +1921,7 @@ mark_hl_fragments(HeadlineParsedText *prs, TSQuery query, int highlight,
19211921
}
19221922
pfree(covers);
19231923
}
1924+
19241925
staticvoid
19251926
mark_hl_words(HeadlineParsedText*prs,TSQueryquery,inthighlight,
19261927
intshortword,intmin_words,intmax_words)
@@ -1981,12 +1982,14 @@ mark_hl_words(HeadlineParsedText *prs, TSQuery query, int highlight,
19811982
if (curlen<min_words&&i >=prs->curwords)
19821983
{/* got end of text and our cover is shoter
19831984
* than min_words */
1984-
for (i=p;i >=0;i--)
1985+
for (i=p-1;i >=0;i--)
19851986
{
19861987
if (!NONWORDTOKEN(prs->words[i].type))
19871988
curlen++;
19881989
if (prs->words[i].item&& !prs->words[i].repeated)
19891990
poslen++;
1991+
if (curlen >=max_words )
1992+
break;
19901993
if (NOENDTOKEN(prs->words[i].type)||prs->words[i].len <=shortword)
19911994
continue;
19921995
if (curlen >=min_words)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp