diff options
author | Tom N Harris <tnharris@whoopdedo.org> | 2011-02-22 02:31:20 -0500 |
---|---|---|
committer | Tom N Harris <tnharris@whoopdedo.org> | 2011-02-22 02:31:20 -0500 |
commit | 0604da3403f907227d3dfe13e6e58d2e78d0c855 (patch) | |
tree | ec676ec9901ccce7d039a48ea9af5a73fa703bd5 | |
parent | b00bd361a6fb93d2ef2433f18f3f238a7498c041 (diff) | |
download | rpg-0604da3403f907227d3dfe13e6e58d2e78d0c855.tar.gz rpg-0604da3403f907227d3dfe13e6e58d2e78d0c855.tar.bz2 |
Removing a page from the index deletes related metadata. Cache key names in index.
-rw-r--r-- | inc/indexer.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/inc/indexer.php b/inc/indexer.php index 0e0340d40..1809b1c8f 100644 --- a/inc/indexer.php +++ b/inc/indexer.php @@ -258,6 +258,7 @@ class Doku_Indexer { foreach ($key as $name => $values) { $metaname = idx_cleanName($name); + $this->_addIndexKey('metadata', '', $metaname); $metaidx = $this->_getIndex($metaname, '_i'); $metawords = $this->_getIndex($metaname, '_w'); $addwords = false; @@ -365,8 +366,17 @@ class Doku_Indexer { return false; } - // XXX TODO: delete meta keys $this->_saveIndexKey('title', '', $pid, ""); + $keyidx = $this->_getIndex('metadata', ''); + foreach ($keyidx as $metaname) { + $val_idx = explode(':', $this->_getIndexKey($metaname.'_p', '', $pid)); + $meta_idx = $this->_getIndex($metaname.'_i', ''); + foreach ($val_idx as $id) { + $meta_idx[$id] = $this->_updateTuple($meta_idx[$id], $pid, 0); + } + $this->_saveIndex($metaname.'_i', '', $meta_idx); + $this->_saveIndexKey($metaname.'_p', '', $pid, ''); + } $this->_unlock(); return true; |