[dokuwiki] Re: AW: Re: bin/indexer.php too chatty?
- From: "Todd Augsburger" <todd@xxxxxxxxxxxxxxxx>
- To: <dokuwiki@xxxxxxxxxxxxx>
- Date: Wed, 12 Sep 2007 16:06:07 -0400
----- Original Message -----
>From: "Gabriel Birke" <Gabriel.Birke@xxxxxxxxx>
>To: <dokuwiki@xxxxxxxxxxxxx>
>Sent: Wednesday, September 12, 2007 11:15 AM
>
>[...]
>I know about the indexer webbug, yes. But it seems it's not working 100%: I
>deleted the name of a staffer from serveral documents. When I do a search
>for that name, the documents still show up. Maybe that's because the name
>contained a hyphen. I hope that doing a complete rebuild of the index once
>a
>week (with the --clear option) will improve things.
I agree that the "stock" DokuWiki does not remove deleted items from the
indexes. My code (for current development version) removes all of the page's
old indexes before adding the currentt ones. (I'd love it if this became
part of the core code, of course.)
[Indexer removes deleted words
Todd Augsburger <todd@xxxxxxxxxxxxxxxx>**20070725000003
Remove indexed page before re-adding words
] {
hunk ./inc/indexer.php 209
- if(!is_int($pid)){
+ if(!is_int($pid)){
hunk ./inc/indexer.php 217
- }
+ } else {
+ $indexfiles = scandir($conf['indexdir']);
+ foreach($indexfiles as $indexfile) {
+ if(preg_match('/^i[0-9]*\.idx$/',$indexfile)) {
+ $fn = $conf['indexdir'].'/'.$indexfile;
+ $changed = false;
+ $lines = file($fn);
+ reset($lines);
+ while (list($key, $line) = each($lines)) {
+ $result = array();
+ $parts = explode(':',trim($line));
+ foreach($parts as $part){
+ if(strtok($part,'*') == $pid)
+ $changed = true;
+ else
+ $result[] = $part;
+ }
+ $lines[$key] = implode(':',$result)."\n";
+ }
+ if($changed) {
+ if($fh = fopen($fn,'w')) {
+ fwrite($fh,implode("",$lines));
+ fclose($fh);
+ }
+ }
+ }
+ }
+ }
}
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
- References:
- [dokuwiki] bin/indexer.php too chatty?
- From: Gabriel Birke
- [dokuwiki] Re: bin/indexer.php too chatty?
- From: Andreas Gohr
- [dokuwiki] AW: Re: bin/indexer.php too chatty?
- From: Gabriel Birke
Other related posts:
- » [dokuwiki] AW: Re: bin/indexer.php too chatty?
- » [dokuwiki] Re: AW: Re: bin/indexer.php too chatty?
- [dokuwiki] bin/indexer.php too chatty?
- From: Gabriel Birke
- [dokuwiki] Re: bin/indexer.php too chatty?
- From: Andreas Gohr
- [dokuwiki] AW: Re: bin/indexer.php too chatty?
- From: Gabriel Birke