diff options
author | Gerrit Uitslag <klapinklapin@gmail.com> | 2014-03-10 23:57:01 +0100 |
---|---|---|
committer | Gerrit Uitslag <klapinklapin@gmail.com> | 2014-03-10 23:57:01 +0100 |
commit | f97db66038968542deefbf9817a3dd49b67b1904 (patch) | |
tree | 6995f5bfd7017999a743c327474afc7b9514d94f /inc/indexer.php | |
parent | 6384941886832589f7bb3c13bc18115499cf9369 (diff) | |
parent | 9f12fc1cc9e916c3172a0cf8953ed70fd18f2ec1 (diff) | |
download | rpg-f97db66038968542deefbf9817a3dd49b67b1904.tar.gz rpg-f97db66038968542deefbf9817a3dd49b67b1904.tar.bz2 |
Merge remote-tracking branch 'origin/master' into userlink
Conflicts:
inc/parser/renderer.php
inc/template.php
Diffstat (limited to 'inc/indexer.php')
-rw-r--r-- | inc/indexer.php | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/inc/indexer.php b/inc/indexer.php index 07f29b542..a167db47f 100644 --- a/inc/indexer.php +++ b/inc/indexer.php @@ -270,8 +270,9 @@ class Doku_Indexer { // Special handling for titles so the index file is simpler if (array_key_exists('title', $key)) { $value = $key['title']; - if (is_array($value)) + if (is_array($value)) { $value = $value[0]; + } $this->saveIndexKey('title', '', $pid, $value); unset($key['title']); } @@ -299,20 +300,24 @@ class Doku_Indexer { if ($val !== "") { $id = array_search($val, $metawords, true); if ($id === false) { + // didn't find $val, so we'll add it to the end of metawords and create a placeholder in metaidx $id = count($metawords); $metawords[$id] = $val; + $metaidx[$id] = ''; $addwords = true; } // test if value is already in the index - if (isset($val_idx[$id]) && $val_idx[$id] <= 0) + if (isset($val_idx[$id]) && $val_idx[$id] <= 0){ $val_idx[$id] = 0; - else // else add it + } else { // else add it $val_idx[$id] = 1; + } } } - if ($addwords) + if ($addwords) { $this->saveIndex($metaname.'_w', '', $metawords); + } $vals_changed = false; foreach ($val_idx as $id => $action) { if ($action == -1) { @@ -1214,14 +1219,16 @@ class Doku_Indexer { */ protected function updateTuple($line, $id, $count) { $newLine = $line; - if ($newLine !== '') + if ($newLine !== ''){ $newLine = preg_replace('/(^|:)'.preg_quote($id,'/').'\*\d*/', '', $newLine); + } $newLine = trim($newLine, ':'); if ($count) { - if (strlen($newLine) > 0) + if (strlen($newLine) > 0) { return "$id*$count:".$newLine; - else + } else { return "$id*$count".$newLine; + } } return $newLine; } |