Displaying a tiddler's "root" tag next to the search results?

78 views
Skip to first unread message

Luca Dorigo

unread,
Feb 16, 2020, 11:16:47 AM2/16/20
to TiddlyWiki
Hi guys!

I've been using Tiddlywiki extensively for notetaking in university over the last 3 years. 
As the amount of tiddlers grew, the search results became harder and harder to read - a search with a relatively common word now easily yields 20+ results:

Screenshot 2020-02-16 at 17.04.53.png



All of my tiddlers are organized using tags, in a tree-like structure. Usually there is one "root" tiddler for each course that I am or have been taking, then each chapter/topic in that course is tagged with the course name, subtopics are tagged with their main topic, and so on. For example:

Screenshot 2020-02-16 at 17.07.21.png



I would like to modify the search results so that I can see, next to the title of the result, which course (i.e. "root tag") it belongs to. The problem is that the leaves in my tag tree (so for example, the "Sannon-Fano Algorithm" tiddler in the picture above) have no direct link to the related course, so there's no way to simply express that in wikitext (that I'm aware of). Could you give me some pointer as to what the best way would be to accomplish this?

The only viable option I thought of is to run a bash script to recursively process all tiddlers in my tiddlers folder, to add a field `root_topic: [[Root Topic Title]]` to each and everyone of them. Then, for all future tiddlers, I can manually (or automatically) add this field to point to the relevant root tiddler. I don't particularly like this option though so I was hoping there's some more idiomatic way to do it :-)

Thanks!

Mark S.

unread,
Feb 16, 2020, 3:19:34 PM2/16/20
to TiddlyWiki
Instead of attempting to modify the existing search, and assuming your have master tag for classes, you could make your own search based on the TOC macro:

<$macrocall $name="toc" tag="TableOfContents"  sort="search{$:/temp/search}"/>

You would change TableOfContents to whatever you're root tag is of course. This uses the "sort" attribute to sneak in search criteria, using the existing search box.

TonyM

unread,
Feb 17, 2020, 2:34:34 AM2/17/20
to TiddlyWiki
Luca,

If I understand this correctly I think the answer is the kin filter https://bimlas.gitlab.io/tw5-kin-filter/

Dropping, save and reload this on tiddlywiki.com

Now I put this in a tiddler tagged  $:/tags/ViewTemplate
<$list filter="[kin<currentTiddler>]">

</$list>

Every tiddler will not display its "kin" if any.

 lets pick a tiddler somewhere lower down in the TOC eg 

DragAndDropMechanism

The Kin ar

Now you could filter this result for tiddlers that you wish to consider a root.

I can explain this in more detail for a specific case but I think you would get a lot more from this by simply learning the power available to you of the kin operator.

Note you can ask just for ancestors and not descendants and a lot more, the key to such organisation can also be how you have added information to your tiddlers that you can use as additional filters. 

Regards
Tony

See the readme/examples in the plugin itself. But lets say you had [kin<currentTiddler>]

A Gloom

unread,
Feb 17, 2020, 2:50:03 AM2/17/20
to TiddlyWiki
very interesting Mark-- it shows branching of the search results...

making it into a sidebar tiddler for temporary ToC's on demand

A Gloom

unread,
Feb 17, 2020, 5:50:10 AM2/17/20
to TiddlyWiki
making it into a sidebar tiddler for temporary ToC's on demand

Not entirely sure what to call it but its something and I see potential mad coding experiments with it...

currently its called the tag search term ToC
it has type in or select a tag *(both can be kept or one or the other can be removed-- both write to the same temp tiddler)
a manual edit duplicate toc macro to compare the modified toc macro call* against *(not modified macro, uses default toc macro) -- can be removed
uses a template tiddler for the edit-text input field to work in the sidebar


#sidebar tagsterm toc template.tid
tag searchterm ~ToC.tid

A Gloom

unread,
Feb 17, 2020, 5:56:06 AM2/17/20
to TiddlyWiki

currently its called the tag search term ToC
it has type in or select a tag *(both can be kept or one or the other can be removed-- both write to the same temp tiddler)
a manual edit duplicate toc macro to compare the modified toc macro call* against *(not modified macro, uses default toc macro) -- can be removed
uses a template tiddler for the edit-text input field to work in the sidebar


Add:
It reads from the searchbar (and displays it in tiddler)

it has an interesting output
Reply all
Reply to author
Forward
0 new messages