Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phantom Tags #62

Closed
serenewaffles opened this issue Apr 5, 2012 · 7 comments
Closed

Phantom Tags #62

serenewaffles opened this issue Apr 5, 2012 · 7 comments

Comments

@serenewaffles
Copy link

I am unsure of what exactly is causing this behavior, but pages are being listed as having tags they do not have in the index file. This is causing issues when listing pages by tag using the pagelist plugin.

For example, I can have a page with
{{tag>tag1 tag3}}

and another page with
{{tag>tag2}}

and sometimes {{topic>tag2}} will cause both pages to be listed. The index says that both pages have tag2, but the pages do not. Rebuilding the index does not resolve the issue, temporarily or permanently.

@so9
Copy link

so9 commented May 10, 2012

After a long time of investigation i found the problem.

(in my case) it's related to a page with two topic-tags

{{topic>abc +def}}
{{topc>abc +ghi}}

when reolading (or purging) the page the meta-datas of the listed pages are rebuild. Unfortunately the file /syntax/tag.php has a problem. It mixes all tags of all loaded pages. A workaround is to separate the tagging for each ID.

For example you can do this :

file wiki/lib/plugins/tag/syntax/tag.php

class syntax_plugin_tag_tag extends DokuWiki_Syntax_Plugin {
var $tags = array();
var $lastid = ""; <- Add this line
.
.
.
function render($mode, &$renderer, $data) {
global $ID;
global $REV;

//add these lines
if ($this->lastid !== $ID)
{
$this->lastid=$ID;
$this->tags=array();
}

The hack clears the tag-array whenever another page is loaded.

I hope this works for you

So9

@serenewaffles
Copy link
Author

My current workaround is actually to use YoBoy's fork

@SumuduF
Copy link

SumuduF commented May 24, 2012

I wish I had looked here before figuring out a similar hack So9!

The issue is that DW assumes the "render" function of a syntax plugin is stateless in some sense, and because the tag plugin keeps track of old tags in the "$this->tags" variable this isn't true. The proper way to code such a thing (I think) is to simply use the array in the metadata renderer ("$renderer->meta['subject']") instead of a member variable. Probably this code was written while DW's metadata renderer was still evolving (IMO it is still very underdocumented esp. wrt. best practices) and it definitely used to work before, so I don't really blame the developers. However it is an easy fix and certainly less wasteful to just use the existing array instead of making a duplicate.

@Cantello
Copy link

Having the same issue here. Which one would be Yoboy's fork? Is it one for DW itself or jsut the tag plugin?

@michitux
Copy link
Member

Could you please try using the metaindex version? It uses DokuWiki's metadata index instead of the tag plugin's own index, you will need to re-index all pages which will happen automatically when you visit them, you can also rebuild the search index manually either using bin/indexer.php or using the searchindex plugin. You can find the metaindex version in the metaindex branch in this repository.

@serenewaffles
Copy link
Author

Sorry for the delay, this was on a production system so I couldn't make the change until recently.

I've switched to the meta index version and so far it seems to be working fine. Should I respond here or open a new issue if I come across anything?

@michitux
Copy link
Member

michitux commented Sep 3, 2012

As the metaindex version is now the main/master version, I'm closing this as I assume this is fixed. For other problems please open new issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants