Cannot filter for real orphans

124 views
Skip to first unread message

bimlas

unread,
May 8, 2020, 3:38:35 AM5/8/20
to TiddlyWiki
Dear all,

To avoid to think about where they end up in the hierarchy when making new notes, I want to create a query that would list tiddlers related to nothing (without tags and backlinks) so I can put them in the right places at the end of the day.

The query below would list these in principle, but I actually get some other results.

<<list-links filter:"[!is[system]!is[orphan]!is[tag]!has[tags]]">>

If you try this code on TW.com and create a new empty tiddler, it will not be listed. Why?

bimlas

unread,
May 8, 2020, 3:41:46 AM5/8/20
to TiddlyWiki
Sorry, a typo is left inside, but it doesn't give the correct result even after correction: "!is[orphan" -> "is[orphan]"

Peter Buyze

unread,
May 8, 2020, 4:24:23 AM5/8/20
to TiddlyWiki forum

Orphans are listed under More in the sidebar.
--
Securely sent with Tutanota. Get your own encrypted, ad-free mailbox:


8 May 2020, 10:38 by bimba....@gmail.com:
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

bimlas

unread,
May 8, 2020, 4:40:23 AM5/8/20
to TiddlyWiki
One step closer: the filter is faulty due to "!has[]", it seems as if "has" doesn't notice that I didn't add a tag to the new tiddler.

[[New Tiddler]!has[tags]]

The output of the filter is empty even though the New Tiddler has no tags.

bimlas

unread,
May 8, 2020, 4:48:56 AM5/8/20
to TiddlyWiki
This term works, so there’s something wrong with ignoring “has”.

[[New Tiddler]] -[has[tags]]

I don't understand how "orphan" works either: the tiddler doesn't contain links and wouldn't point hard links to it, but the filter output is empty.

[[New Tiddler]is[orphan]]


bimlas

unread,
May 8, 2020, 4:54:44 AM5/8/20
to TiddlyWiki
The condition for inverting "has" is faulty because "tags" is an array, not a string. I will send a PR with the fix later.

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/filters/has.js#L53-L65

bimlas

unread,
May 8, 2020, 5:00:13 AM5/8/20
to TiddlyWiki
"is[orphan]" uses this function with a TODO at the end, maybe something is missing? (although the code looks good)

https://github.com/Jermolene/TiddlyWiki5/blob/81f07cdf852d8dd7c8e8e41984a6193c5d9a9c15/core/modules/wiki.js#L495-L507

TonyM

unread,
May 8, 2020, 5:43:10 AM5/8/20
to TiddlyWiki
Bimlas

I wonder if this subtle fact could make a difference.

has[tags] asks if there is a non empty tags field. And thus !has[tags] is a double negative not non empty. I find it safer to use has:field[tags] will return if it exists at all, with a value or not. The negation should indicate there is no tags field at all.

Regards
Tony

bimlas

unread,
May 8, 2020, 6:24:17 AM5/8/20
to TiddlyWiki
TonyM,

Although a newly created tiddler has a tags field, it is just empty. The negated "has" means "those input tiddlers in which field F does not exist or has an empty value", exactly this is what I need because I want to know if a tiddler has tags or not (something is written in the tags field in addition to the tiddler having such a field). The current behaviour of "!has[tags]" is a programming error that needs to be fixed and I will do it later.

If you create an empty tiddler and try the filter you mentioned with it, you will also get an incorrect result because the "tags" field of the tiddler is empty, yet it will appear in the output of the filter.

[[New Tiddler]has:field[tags]]


bimlas

unread,
May 8, 2020, 6:46:43 PM5/8/20
to TiddlyWiki

bimlas

unread,
May 8, 2020, 6:57:05 PM5/8/20
to TiddlyWiki
I don't understand how "orphan" works either: the tiddler doesn't contain links and wouldn't point hard links to it, but the filter output is empty.

[[New Tiddler]is[orphan]]
 
I'm sorry, I may have looked something up here, because whatever I'm trying to bring up the issue again, now everything seems to be fine with this filter.

Saq Imtiaz

unread,
May 8, 2020, 7:59:41 PM5/8/20
to TiddlyWiki
@bimlas there is a similar issue with the list field:

https://github.com/Jermolene/TiddlyWiki5/pull/4567

bimlas

unread,
May 9, 2020, 3:21:29 AM5/9/20
to TiddlyWiki
Saq,

You are right, it's the same issue, so the problem is fixed twice. :)

Saq Imtiaz

unread,
May 9, 2020, 3:57:03 AM5/9/20
to TiddlyWiki
@bimlas I think your pull request is more thorough so once it is merged I will close mine.
Reply all
Reply to author
Forward
0 new messages