forrestthewoods / lib_fts

single-file public domain libraries
661 stars 139 forks source link

Leading letter penalty maximum check is inverted? #25

Closed elihart closed 4 years ago

elihart commented 4 years ago

Hi, unless I'm reading the source wrong it seems that max_leading_letter_penalty should be set as the penalty if the initial penalty is greater than the max.

The current implementation acts like a minimum penalty.

            // Apply leading letter penalty
            int penalty = leading_letter_penalty * matches[0];
            if (penalty < max_leading_letter_penalty)
                penalty = max_leading_letter_penalty;
elihart commented 4 years ago

my mistake, these are negative values so this is correct!