Filter of multiple tags in tidgraph plugins

I am using Tidgraph to display the graph for tag/tiddler relationship.

The filter option can be used to filter the specific tag, e.g.

<$tidgraph start="root" filter="[tag[Domain]]" />

I would like to filter for two tags (i.e. tillders with tag Domain or Doc).

Is there a way to achieve it?

PS: this is the js codes used in tidgraph.

filter = '[[' + tid + ']tagging[]]+' + tidtree.filter;

where tid is the tiddler name of starting point.

Hi @Zheng_Bangyou

Can you try this (untested):
[tag[Domain]] +[tag[Doc]]

Fred

Thanks it is not working.

If you use [tag[Domain]] [tag[Doc]] it will list tiddlers with each tag and remove any duplicates between each list.

Thanks @TW_Tones. I found a solution using search filter.

<$tidgraph start="Crop" filter="[search:tags:regexp[Domain|Doc]]" />

Maybe not an issue in your case but your regexp search might match on tags you don’t want them to like “Docs”, “Documents”, “Doctor”, “Domains”, etc.

@TW_Tones’ solution would be less error-prone, I think, and would be equivalent to [tag[Domain]] :or[tag[Doc]]

/Mike

2 Likes

You could also use:

<$tidgraph start="Crop" filter="[search:tags:some[Domain Doc]]" />

which treats the specified filter operand (“Domain Doc”) as “a list of tokens separated by whitespace, and matches if at least one of the tokens appear in the string”. Note that it’s not clear to me whether internally this is more efficient than using regexp, but it does offer another way to achieve your desired result. You might want to do some testing with “big data” (i.e., lots of tiddlers with lots of tags) to see if it gives better performance than the regexp search mode flag.

1 Like

This regular expression will solve your concern

<$tidgraph start="Crop" filter="[search:tags:regexp[^(Domain|Doc)$]]" />

Sorry This code is not working for my case as tidgraph widget generate filter on the fly for each tiddler.