Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IDEA] Use of Modern Filter with $:/Advanced Search Through Predefined Filters #7196

Open
kookma opened this issue Jan 9, 2023 · 2 comments

Comments

@kookma
Copy link
Contributor

kookma commented Jan 9, 2023

Is your feature request related to a problem? Please describe.
I wish to retrieve all tiddler titles in a TOC tree through $:/AdvancedSearch -> Filter

Describe the solution you'd like
From TW 5.1.23 we have some modern filter operators and filter run prefixes can perform complex operations. To use the full power of these features in predefined filters (tagged with $:/tags/Filter) you may need to use variables.

There is a solution for rederiving all tiddler titles in a TOC tree in https://talk.tiddlywiki.org/t/filter-question-return-all-toc-tiddler-titles-as-a-plain-list/5752/10 proposed by @yaisog. This solution needs variables in filter.

A problem
Is it possible to have the variables in tiddler defines this filter and is tagged with $:/tags/Filter?
One may define all variables in a tiddler tagged $:/tags/Macro

Code and demo

  1. download list-all-toc-tree.zip
  2. drag and drop https://tiddlywiki.com
  3. Open $:/AdvancedSearch -> Filter -> Dropdown and select List TOC tree tiddlers

Here I used both tags $:/tags/Macro and $:/tags/Filter on the same tiddler, but this makes the variables global (not good)

@Jermolene
Copy link
Owner

Hi @kookma it would indeed be useful to have something like the kin operator in the core. My preferred route is not just to provide a special operator for treewalking, but to extend the filter syntax so that it is straightforward and safe to write recursive functions. Thus, I think the first step is actually the implementation of user defined functions in #6666. That gives us named functions with named parameters, which are the building blocks of recursion in functional languages.

I appreciate that in the meantime you are asking for an extension to the advanced search canned filter system to permit named variables to be specified for the filter. There may be a useful feature along those lines, but I think the development needs to be driven by more diverse use cases than this. The implementation in the thread is breathtakingly clever, but it is not clear that it is representative of the filters that users would ordinarily encounter.

@kookma
Copy link
Contributor Author

kookma commented Jan 10, 2023

Thank you for clarification @Jermolene
It seems having a core recursive filter and merging #6666 will bring us many flexibilities. In addition to kin I saw in the forum a recursive filter has been developed by @yaisog (see https://talk.tiddlywiki.org/t/recursive-filter-operators-to-show-all-tiddlers-beneath-a-tag-and-all-tags-above-a-tiddler/3814).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants