diff options
Diffstat (limited to 'inc/indexer.php')
-rw-r--r-- | inc/indexer.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/inc/indexer.php b/inc/indexer.php index 1f2ff89e3..14af579bb 100644 --- a/inc/indexer.php +++ b/inc/indexer.php @@ -74,7 +74,7 @@ function idx_saveIndex($pre, $wlen, &$idx){ fwrite($fh,$line); } fclose($fh); - if($conf['fperm']) chmod($fn.'.tmp', $conf['fperm']); + if(isset($conf['fperm'])) chmod($fn.'.tmp', $conf['fperm']); io_rename($fn.'.tmp', $fn.'.idx'); return true; } @@ -574,12 +574,16 @@ function idx_lookup($words){ // merge found pages into final result array $final = array(); - foreach(array_keys($result) as $word){ + foreach($result as $word => $res){ $final[$word] = array(); - foreach($result[$word] as $wid){ + foreach($res as $wid){ $hits = &$docs[$wid]; foreach ($hits as $hitkey => $hitcnt) { - $final[$word][$hitkey] = $hitcnt + $final[$word][$hitkey]; + if (!isset($final[$word][$hitkey])) { + $final[$word][$hitkey] = $hitcnt; + } else { + $final[$word][$hitkey] += $hitcnt; + } } } } |