[tw5] How to permanently exclude tiddler with a certain field from standard search ?

Hello everybody,

I’m using the plugin “Streams” for one of my tiddlywiki.
For now, the only but big downside is that the standard search bar is useless as I have a lot of tiddlers with more or less the same name.
I just want to search for the original tiddler who has no field name parent in it.
So I’m currently searching how to add a “!has[parent]” filter on the standard search bar but frankly, I’m stuck on which shadow tiddler I need to modify.

Can you help me ?

Thank you !

See https://tiddlywiki.com/#Customising%20search%20results

1 Like

Sorry I should’ve have say that I have little to no background in informatic or coding. I already searched on my own on the official tiddlywiki (and saw the link listed here) and searched online if someone has a problem similar to mine.
I kind of understand what is explained in the official wiki but not enough to know where to put the condition.
My actual capabilities are limited to finding a problem similar to mine and just tweak it enough to match what I intend to do right now

Try this. (It may not be the most elegant, in terms of coding, but it’s an easy and safe tweak to do.)

Using Advanced Search, find the system tiddler with this title: $:/core/ui/DefaultSearchResultList

Make a copy (clone) of it, changing the title at the end to something you’ll recognize. (That way, you’re not directly over-writing the default version.)

In the cloned copy, don’t touch the main text body at all. Just change three fields (ignoring back-tick marks, if they show up for you):

first-search-filter: :arrow_right: [!is[system]!has[parent]search:title<userInput>sort[title]limit[250]]

second-search-filter: :arrow_right:[!is[system]!has[parent]search<userInput>sort[title]limit[250]]

caption: :arrow_right: top-level
[or whatever you like, to clarify the doesn’t-have-parent concept]

What these edits do is just to add the string !has[parent] within the search filters, to exclude tiddlers with content in the parent field.

One last step, with that system tiddler in view mode, is to click on the $:/tags/SearchResults tag-pill to get the dropdown of search-result templates, and rearrange the order of the search result types, so that the new custom search you prefer is listed at top.

Come back if any of that does not seem straightforward!

-Springer

Thank you, it’s working !
I finally understand that field can be used to define a function too haha. I tried to attribute something to first-search-filter but didn’t understand how it’s worked.
Thank to your simple and easy explanation, I finally made it.

Have a nice day

1 Like