[TW5] New plugin: tobibeer/filter

159 views
Skip to first unread message

Tobias Beer

unread,
Dec 29, 2015, 4:47:38 AM12/29/15
to TiddlyWiki
Hey everyone,

after having retracted the initial release,
here comes the "2nd first release" version 0.5.5 of tobibeer/filter:


It provides...
filter[]
a filter allowing to evaluate subfilters in a filter expression

Syntax Variants

[filter<subfilter>]
evaluates subfilter against each input title
sets the variable inputTitle to each title in turn
uses each input title as the source for the subfilter
[filter{subfilter}]
retrieves the subfilter from a text-reference
[filter:input<subfilter>]
uses all input titles as the source for the subfilter
[filter: var:item<subfilter>]
sets variable item to each input title in turn
[filter:$ var:item<subfilter>]
returns input titles with matches, sets item
[filter:$all input{subfilter}]
returns all input titles if any had matches
evaluates for each input title against all input titles

Why?
  • to avoid having to nest list widgets in list widgets
    • that may not even allow to retrieve the same aggregated results
  • to avail nested filters to a single SetWidget or setvars widget instance

Best wishes,

Tobias.

Jed Carty

unread,
Dec 29, 2015, 5:10:24 AM12/29/15
to TiddlyWiki
Thank you! I think that this is the last thing I need for adding search by field contents to tiddler tool. Unfortunately it may be a while before I can add it.

Tobias Beer

unread,
Jan 8, 2016, 1:48:30 PM1/8/16
to TiddlyWiki
Hi again,

allows to use %variable-placeholders% anywhere in the subfilter.

Get the update from here:


Here's an example what that looks like:

<$vars
prefix="!"
filter="field"
suffix="title"
operand="filter"
subfilter="[%prefix%%filter%:%suffix%[%operand%]]">

{{{ [prefix[filter]filter
<subfilter>] }}}
</$vars>

Best wishes,

Tobias.

Tobias Beer

unread,
Jan 8, 2016, 1:49:46 PM1/8/16
to TiddlyWiki
Hi Jed,
 
Thank you! I think that this is the last thing I need for adding search by field contents to tiddler tool. Unfortunately it may be a while before I can add it.

Version 0.5.6 will make this much more flexible for you:

Here are a bunch of examples:


Best wishes,

Tobias. 

Mat

unread,
Jan 8, 2016, 3:49:01 PM1/8/16
to TiddlyWiki
@Jed wrote:
Thank you! I think that this is the last thing I need

Yo cool it bro, ain't nobody forcin you!  ;-)


@Tobias
Joking aside; regarding "avoiding nested list widgets" - does your plugin "merely" provide a smoother interface or does it really somehow circumvent to nest lists? I mean, I don't doubt your plugin is preferable to nesting lists but does it also improve performance compared to standard?

BTW, I'll be using this on TWaddle where I have some expensive list'o lists. Thank you!

<:-)

cmari

unread,
Jan 9, 2016, 1:27:49 PM1/9/16
to TiddlyWiki
@Tobias,
I think the link in the summary field inside your example tiddler "Search Multiple Fields with a Subfilter" still goes to the earlier version of the filter plugin? (I got javascript errors).

One other comment (bearing in mind I'm a non-expert): after reading the preface to the examples, I initially thought the search term was going to be the word "filter" itself (that's how I interpreted " using the filter operator filter to search for the word filter ").
It might help clarify things to state explicitly that in all of the examples the term being searched for is the word "Evaluate" (I think!).

cmari

Tobias Beer

unread,
Jan 9, 2016, 3:30:54 PM1/9/16
to TiddlyWiki
 Hi cmari,

I think the link in the summary field inside your example tiddler "Search Multiple Fields with a Subfilter" still goes to the earlier version of the filter plugin? (I got javascript errors).

Not sure what might have happened there. I tested Chrome and FF and get no errors. Can you give more details when the error occurs?
 
One other comment (bearing in mind I'm a non-expert): after reading the preface to the examples, I initially thought the search term was going to be the word "filter" itself (that's how I interpreted " using the filter operator filter to search for the word filter ").

Oh, sorry. That must have been quite confusing. Fixed.

It might help clarify things to state explicitly that in all of the examples the term being searched for is the word "Evaluate" (I think!).

Yes, that is correct. I have updated the example so now they probably make a lot more sense. ;-)

Best wishes,

Tobias. 

Tobias Beer

unread,
Jan 9, 2016, 3:33:15 PM1/9/16
to TiddlyWiki
Hi Mat,
 
Joking aside; regarding "avoiding nested list widgets" - does your plugin "merely" provide a smoother interface or does it really somehow circumvent to nest lists? I mean, I don't doubt your plugin is preferable to nesting lists but does it also improve performance compared to standard?

It evaluates however many filters and subfilters as you want in one filter expression. Obviously, that can have a performance impact, but no more than doing the same using nested widgets, presumably less... for obvious reasons. Also, something like sorting nested lists is quite a different thing than sorting one result list... isn't it? ;-)
 
BTW, I'll be using this on TWaddle where I have some expensive list'o lists. Thank you!

Great... let us know how that goes or if you should get stuck.

Best wishes,

Tobias.

cmari

unread,
Jan 9, 2016, 4:35:04 PM1/9/16
to TiddlyWiki
Here's what I did:
Clicked the link to "Search Multiple Fields with a Subfilter" in this thread:
https://groups.google.com/d/msgid/tiddlywiki/7152daf5-f0f0-4282-9167-806f96106655%40googlegroups.com

At the top of the tiddler, I clicked the word "filter" in the sentence
how to evaluate subfilters using the operator filter to search multiple fields at once, optionally using the split filter

This took me to a tiddler with an Info tab. First text in that tab is:
The plugin $:/plugins/tobibeer/filter provides:

I dragged that link into an empty 5.1.10 TW, saved, and reloaded.

Then I created a new tiddler and pasted in the text of the first example in "Search Multiple Fields with a Subfilter". I changed the search term so it would find something in my file.
While editing, I clicked the "show preview" button.
Removing the space in front of either of the plus signs (+) in the example produced the "Well this is embarrassing" error.

Hope that's clear!
cmari

Tobias Beer

unread,
Jan 9, 2016, 9:12:30 PM1/9/16
to TiddlyWiki
Hi cmari,

Removing the space in front of either of the plus signs (+) in the example produced the "Well this is embarrassing" error.

Thanks for the detailed report.
With this very last step I could reproduce the error.
Will investigate tomorrow.

One thing's for sure, removing that + sign
from the filter expression will have the subfilter evaluated
against whatever the [all[]] filter returns.

Best wishes,

Tobias.

Tobias Beer

unread,
Jan 10, 2016, 4:39:11 AM1/10/16
to TiddlyWiki
Hi again, cmari,
 
Thanks for the detailed report.
With this very last step I could reproduce the error.
Will investigate tomorrow.

One thing's for sure, removing that + sign
from the filter expression will have the subfilter evaluated
against whatever the [all[]] filter returns.

Turns out I was about right that stuffing any tiddler title including system titles
anywhere into the filter expression would easily yield a broken subfilter.

I announced an update to tobibeer/filter here.
So, version 0.5.7 now handles errors more gracefully.

Best wishes,

Tobias.
Reply all
Reply to author
Forward
0 new messages