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

Commit4e71240

Browse files
committed
Now that I look at it, is_stopword() is broken and always has been.
Doesn't anyone remember how to program a binary search??
1 parent6d87107 commit4e71240

File tree

1 file changed

+3
-4
lines changed
  • contrib/fulltextindex

1 file changed

+3
-4
lines changed

‎contrib/fulltextindex/fti.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,9 @@ is_stopword(char *text)
351351
StopLow=&StopWords[0];/* initialize stuff for binary search */
352352
StopHigh=endof(StopWords);
353353

354-
if (lengthof(StopWords)==0)
355-
return false;
354+
/* Loop invariant: *StopLow <= text < *StopHigh */
356355

357-
while (StopLow <=StopHigh)
356+
while (StopLow<StopHigh)
358357
{
359358
StopMiddle=StopLow+ (StopHigh-StopLow) /2;
360359
difference=strcmp(*StopMiddle,text);
@@ -363,7 +362,7 @@ is_stopword(char *text)
363362
elseif (difference<0)
364363
StopLow=StopMiddle+1;
365364
else
366-
StopHigh=StopMiddle-1;
365+
StopHigh=StopMiddle;
367366
}
368367

369368
return (false);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp