mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-25 05:22:59 +00:00
libsearchengine/didyoumean: fix infinite loop
This commit is contained in:
parent
d294c7e89a
commit
9f4dd1c149
1 changed files with 4 additions and 2 deletions
|
@ -677,7 +677,9 @@ class search
|
||||||
error_log("[stas_parse/didyoumean] Now looking at #$i: ".var_export($result["terms"][$i], true)."(total count: $terms_count)");
|
error_log("[stas_parse/didyoumean] Now looking at #$i: ".var_export($result["terms"][$i], true)."(total count: $terms_count)");
|
||||||
if($result["terms"][$i]["exact"] || // Skip exact-only
|
if($result["terms"][$i]["exact"] || // Skip exact-only
|
||||||
$result["terms"][$i]["weight"] < 1 || // Skip stop & irrelevant words
|
$result["terms"][$i]["weight"] < 1 || // Skip stop & irrelevant words
|
||||||
self::invindex_term_exists($result["terms"][$i]["term"])) continue;
|
self::invindex_term_exists($result["terms"][$i]["term"])) {
|
||||||
|
$i++; continue;
|
||||||
|
}
|
||||||
|
|
||||||
// It's not a stop word or in the index, try and correct it
|
// It's not a stop word or in the index, try and correct it
|
||||||
// self::didyoumean_correct auto-loads the didyoumean index on-demand
|
// self::didyoumean_correct auto-loads the didyoumean index on-demand
|
||||||
|
@ -685,7 +687,7 @@ class search
|
||||||
// Make a note if we fail to correct a term
|
// Make a note if we fail to correct a term
|
||||||
if(!is_string($correction)) {
|
if(!is_string($correction)) {
|
||||||
$result["terms"][$i]["corrected"] = false;
|
$result["terms"][$i]["corrected"] = false;
|
||||||
continue;
|
$i++; continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result["terms"][$i]["term_before"] = $result["terms"][$i]["term"];
|
$result["terms"][$i]["term_before"] = $result["terms"][$i]["term"];
|
||||||
|
|
Loading…
Reference in a new issue