Fix generation of too long headline with ShortWords.
Per http://archives.postgresql.org/pgsql-hackers/2008-09/msg01088.php
This commit is contained in:
parent
09156de640
commit
90208cc2fb
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.14.2.1 2008/10/17 17:32:59 teodor Exp $
|
* $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.14.2.2 2009/01/15 17:05:39 teodor Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1799,12 +1799,14 @@ prsd_headline(PG_FUNCTION_ARGS)
|
|||||||
if (curlen < min_words && i >= prs->curwords)
|
if (curlen < min_words && i >= prs->curwords)
|
||||||
{ /* got end of text and our cover is shoter
|
{ /* got end of text and our cover is shoter
|
||||||
* than min_words */
|
* than min_words */
|
||||||
for (i = p; i >= 0; i--)
|
for (i = p - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (!NONWORDTOKEN(prs->words[i].type))
|
if (!NONWORDTOKEN(prs->words[i].type))
|
||||||
curlen++;
|
curlen++;
|
||||||
if (prs->words[i].item && !prs->words[i].repeated)
|
if (prs->words[i].item && !prs->words[i].repeated)
|
||||||
poslen++;
|
poslen++;
|
||||||
|
if ( curlen >= max_words )
|
||||||
|
break;
|
||||||
if (NOENDTOKEN(prs->words[i].type) || prs->words[i].len <= shortword)
|
if (NOENDTOKEN(prs->words[i].type) || prs->words[i].len <= shortword)
|
||||||
continue;
|
continue;
|
||||||
if (curlen >= min_words)
|
if (curlen >= min_words)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user