contains filter operator

76 views
Skip to first unread message

Mohammad

unread,
Aug 2, 2019, 4:14:19 AM8/2/19
to TiddlyWiki
Why this gives no result


<$list filter="[range[1,15]]">
<$list filter="[<currentTiddler>contains:title[6]]">
This is  6
</$list>
</$list>


I expect on 6 it shows the message

This is  6

--Mohammad

Jeremy Ruston

unread,
Aug 2, 2019, 4:23:05 AM8/2/19
to tiddl...@googlegroups.com
Hi Mohammad

The “contains” operator works on list fields of tiddlers that exist. Here, the tiddlers “1”, “2”, “3” etc. don’t exist, and so the operator won’t do anything useful.

Best wishes

Jeremy.


This is  6

--Mohammad

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/91dd3283-0a85-40aa-8a99-73f76493c869%40googlegroups.com.

Mohammad

unread,
Aug 2, 2019, 4:35:57 AM8/2/19
to TiddlyWiki
Thanks, so the input tiddlers need to have a list field!

Best
Mohammad


On Friday, August 2, 2019 at 12:53:05 PM UTC+4:30, Jeremy Ruston wrote:
Hi Mohammad

Why this gives no result


<$list filter="[range[1,15]]">
<$list filter="[<currentTiddler>contains:title[6]]">
This is  6
</$list>
</$list>


I expect on 6 it shows the message

The “contains” operator works on list fields of tiddlers that exist. Here, the tiddlers “1”, “2”, “3” etc. don’t exist, and so the operator won’t do anything useful.

Best wishes

Jeremy.


This is  6

--Mohammad

--
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 tiddl...@googlegroups.com.

Mat

unread,
Aug 2, 2019, 6:27:26 AM8/2/19
to TiddlyWiki
@Jeremy

But according to docs, it should be possible to add a field suffix which Muhammad does: contains:title[6]   - ?

Is it perhaps because 6 is missing and the operator really searches inside it's title field... which is of course missing? Most(?) other operators can use a title field that in reality is missing.

<:-)

Jeremy Ruston

unread,
Aug 2, 2019, 10:04:16 AM8/2/19
to tiddl...@googlegroups.com
Hi Mat

@Jeremy

But according to docs, it should be possible to add a field suffix which Muhammad does: contains:title[6]   - ?

Is it perhaps because 6 is missing and the operator really searches inside it's title field... which is of course missing? Most(?) other operators can use a title field that in reality is missing.

The other restriction I mentioned for the contains operator is that it only works with tiddlers that exist, it doesn’t work when applied to titles that don’t exist as tiddlers.

Best wishes

Jeremy


<:-)

--
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.

Mat

unread,
Aug 2, 2019, 10:34:40 AM8/2/19
to TiddlyWiki
Jeremy Ruston wrote:
The other restriction I mentioned for the contains operator is that it only works with tiddlers that exist, it doesn’t work when applied to titles that don’t exist as tiddlers.

Is there a particular reason for why the contains operator behaves in this way where most other operators don't?

<:-) 

Jeremy Ruston

unread,
Aug 2, 2019, 10:38:02 AM8/2/19
to tiddl...@googlegroups.com
Hi Mat


On 2 Aug 2019, at 15:34, Mat <matia...@gmail.com> wrote:

Is there a particular reason for why the contains operator behaves in this way where most other operators don't?

Most operators work on the titles alone (and so don’t require the underyling tiddler to exist), but some work on the underlying tiddlers (eg. “[tags[]]”). The contains operator could have made a special case for working with the title field but it still wouldn’t do what you want because it would still convert the title to a list, so a title like “Hello Jeremy” would be converted to a list with two entries [[Hello]] [[Jeremy]], and then it would be checking whether either of those entries contains the specified string.

Best wishes

Jeremy.

Mat

unread,
Aug 2, 2019, 11:58:58 AM8/2/19
to TiddlyWiki
Jeremy, thank you for your very informative answers. Here and everywhere.

<:-)


TonyM

unread,
Aug 2, 2019, 6:48:59 PM8/2/19
to TiddlyWiki
Knowing contains operates this way could be quite helpful.

In someways it is doing a tiddler exists test in addition to a search of contents.

Regards
Tony

TonyM

unread,
Aug 2, 2019, 7:04:56 PM8/2/19
to TiddlyWiki
Speculation,

What if we iterated all words in text and test to see if they are "contained" elsewhere. If they are contained in multiple tiddlers we could optional create a tiddler of a word such that we provide a link to its use throughout the wiki, then the following may also be possible;

What if when we were typing in the editor, and words of > 3 characters were always looked up in tiddler titles and we could select a tiddler containing the word to autocomplete and insert a link to that word (tiddler) OR transclude OR insert content of the tiddler containing that word. If the word is but one in the title then we could select the whole title to insert phrases we wish to reuse.

This could help insert macro syntax, or write variations of a proposal, or allow us to insert module of content directly at edit time or much more. In a way it would be like putting a command line into an editor.

The above could all be done with a special "preemptive text - editor" to keep its impact simple.

Regards
Tony 

Mat

unread,
Aug 2, 2019, 7:50:00 PM8/2/19
to TiddlyWiki
Tony, while you're definitely drifting from the topic - you also happen to do so into an area that I would very much like to explore.

Just the other day I created this:

 http://editorpopup.tiddlyspot.com/  (btw, I believe I briefly mention you there ;-)

as a carification to issue #3784 . Give it a thubs up if you approve of it. (@ everyone)

<:-)
Reply all
Reply to author
Forward
0 new messages