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

Commit9be664d

Browse files
committed
Further cleanup of ts_headline code.
Suppress a probably-meaningless uninitialized-variable warning(induced by my previous patch, I'm sorry to say).Improve mark_hl_fragments()'s test for overlapping cover strings:it failed to consider the possibility that the current string isstrictly within another one. That's unlikely given the precedingsplitting into MaxWords fragments, but I don't think it's impossible.Discussion:https://postgr.es/m/16345-2e0cf5cddbdcd3b4@postgresql.org
1 parent2971180 commit9be664d

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

‎src/backend/tsearch/wparser_def.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,22 +2434,24 @@ mark_hl_fragments(HeadlineParsedText *prs, TSQuery query, bool highlightall,
24342434
/* Mark the chosen fragments (covers) */
24352435
mark_fragment(prs,highlightall,startpos,endpos);
24362436
num_f++;
2437-
/*excludeoverlappingcovers */
2437+
/*Exclude coversoverlappingthis one from future consideration */
24382438
for (i=0;i<numcovers;i++)
24392439
{
24402440
if (i!=minI&&
2441-
((covers[i].startpos >=covers[minI].startpos&&
2442-
covers[i].startpos <=covers[minI].endpos)||
2443-
(covers[i].endpos >=covers[minI].startpos&&
2444-
covers[i].endpos <=covers[minI].endpos)))
2441+
((covers[i].startpos >=startpos&&
2442+
covers[i].startpos <=endpos)||
2443+
(covers[i].endpos >=startpos&&
2444+
covers[i].endpos <=endpos)||
2445+
(covers[i].startpos<startpos&&
2446+
covers[i].endpos>endpos)))
24452447
covers[i].excluded= true;
24462448
}
24472449
}
24482450
else
2449-
break;
2451+
break;/* no selectable covers remain */
24502452
}
24512453

2452-
/* showat least min_words if we have not marked anything */
2454+
/* showthe first min_words words if we have not marked anything */
24532455
if (num_f <=0)
24542456
{
24552457
startpos=endpos=curlen=0;
@@ -2607,6 +2609,7 @@ mark_hl_words(HeadlineParsedText *prs, TSQuery query, bool highlightall,
26072609
if (bestlen<0)
26082610
{
26092611
curlen=0;
2612+
pose=0;
26102613
for (i=0;i<prs->curwords&&curlen<min_words;i++)
26112614
{
26122615
if (!NONWORDTOKEN(prs->words[i].type))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp