Issue Bug Closed

#47745indexed_search / Indexer: frequency mapping buggy

Ralf Hettinger 04/30/13, 16:10 updated 10/02/18, 12:13

Description

There is a slight glitch in indexed_search’s indexer, which results in a wrong frequency mapping if the ratio between number of current word / all words is exactly 1. The “frequency” for this word should be mapped to the highest possible value, but is mapped to -INF due to a wrong if condition.

For testing: this may happen if indexed_search indexes a blank page having only a page title and this title having only one word (therefore ratio 1/1 = 1).
Symptom of the bug: ###RATING### marker will have funny values for rank_flag (blank) and rank_freq (-INF%) for the corresponding result if you search for this page’s title.

Fix:

$mapFactor = $this->freqMax * 100 * $this->freqRange;
if ($freq < 1) {
 $newFreq = $freq * $mapFactor;

should be:

$mapFactor = $this->freqMax * 100 * $this->freqRange;
if ($freq <= 1) {
 $newFreq = $freq * $mapFactor;

Reviews 2