Searching for streams content

Hi ,

I am using streams. and I love it , but I ran into a small problem, i cant really search for the streams content of a tiddler, because its all stored in $:/ system /state tiddlers

the advanced search brings up the state tiddler, but i was wondering if there is a better way .

does any one know of a way around this ? perhaps a way to find the actual tiddler that is “hosting” a particular stream i am searching for ?

thank you

You’ll need to explain what’s wrong with using the system tab of the advanced search.

I just realized that you can tag the advanced search with $:/tags/SideBar, give it a caption, and have it appear as a tab in the sidebar. Which might be more convenient if you use advanced search a lot.

Thanks,

I believe the problem statement should be , i cannot search for tiddlers using their streams content as search criteria as i would normally search for a tiddler using its text field content as search criteria

so if you would have for example , tiddler A which holds the stream B and undernath it C and D

streams B C D and D despite being displayed as if they are part of the text field , they are not, and are actually separate tiddlers with different names , and so seraching using “B” , “C” or “D” will yield no results

Tidler A
*B
**C
**D

i know this is not inlign with Streams design, and would also yield multiple results as tiddler"B" (in its true name)also holds “C” and “D” ,so searching for D would bring up “A” and “B” but at least that would be better

the streams layout still looks like a standard tiddler with a title and contents ,so it kinda feels like you’d want, as with normal tiddlers ,to find stream tiddlers as well searching by their contents , i dont know is it just me ? :slight_smile:

i dont know if i am right, but that’s my use case i guess :slight_smile: i store notes in streams , but sometimes cant find the master tiddler holding my notes (streams) because i dont remember exactly the name of the tiddler, and cant really serach on my notes because they are stored in state/system tiddlers

The lazy way would be to just click on the seach result and then use the breadcrumbs shown at the top to navigate to the root tiddler.

The more involved but better way would be to create a custom search view that searches all tiddlers but only shows the root tiddler for each match. There are prior examples/discussion around this in the community, either here on discourse or on https://groups.google.com/g/tiddlywiki/

1 Like

Depending on the naming standard you use in streams, because its configurable, you may need different strategies to find which tiddler a stream item belongs.

I think the default was tiddlername/serialnumber but since I wanted to keep those out of recent lists I used $:/streams/serial number since the serial numbers are unique.

There are fields in each stream item or the tiddler they belong to you can access to find there source.

As @saqimtiaz suggested there would be value making a custom search. Such a solution would Idealy be independant of the tiddler naming. Hiding the stream item title and showing its content may suggest separating it from the standard search makes sense.

I am looking at adopting streams to help me respond to job applications, so I will keep this in mind. And try and share back.

[Edited]

For example consider this naming standard $:/streams/<<stream-root-title>>/<<now "[UTC]YYYY0MM0DD0hh0mm0ssXXX">> if you allow search of system tiddlers and find a stream item, you can [removeprefix[$:/streams/]split[/]first[]] to get the “stream-root-title”.

1 Like

I’m not sure whether this is the most efficient approach, but here’s a filter that uses the kin filter operator (unofficial, available as a plugin) to return the “host” tiddler:

[is[system]has[stream-type]search:text<searchTerm>] +[kin:stream-list:to[]!has[parent]] +[unique[]sortan[]]

Here, I limited the search to system tiddlers since all your streams tiddlers have the system prefix, but you could remove is[system] if you were using a different naming scheme, or further reduce the initial scope of the search by replacing it with the specific streams prefix you’re using.

You could pair this with a custom search box as @saqimtiaz suggested:

\function searchTerm() [{$:/temp/volatile/streams-search}]

<$edit-text tiddler="$:/temp/volatile/streams-search" tag=input placeholder="Search streams" />

<<list-links "[<searchTerm>minlength[3]] :then[is[system]has[stream-type]search:text<searchTerm>] +[kin:stream-list:to[]!has[parent]] +[unique[]sortan[]]">>
1 Like

Note that streams comes with a get-stream-root[] filter that can be used to get the root/host of any node.

For creating a custom search presentation, see https://tiddlywiki.com/#Customising%20search%20results

2 Likes

Thanks Saq, super helpful! If I ever noticed that operator, I’d definitely forgotten. Time to go refactor some filters myself!

Attached is a custom search view for Streams. I personally don’t recommend using system titles (that is starting with $:/) for the nodes, so if that is your naming schema you will need to customize the filters in the fields first-search-filter and second-search-filter to allow system tiddlers.

$__plugins_sq_streams-search-results.json (1.2 KB)

Import that tiddler, customize the filters if you need to and just use the normal search. Note that there are two tabs in the results now.

image

To make the streams search the default, create a tiddler called $:/config/SearchResults/Default containing the title of the tiddler containing the search view, i.e. $:/plugins/sq/streams-search-results

1 Like

Here is another variant from a few years ago, that shows the root for each search match, OR the nearest ancestor whose title is not prefixed with its parent’s title.

https://saqimtiaz.github.io/sq-tw/streams-deprecated.html#%24%3A%2Fplugins%2Fsq%2Fstreams-search

I believe the usage pattern of the user for whom this was created, was to use automatic titles, and to rename a node if they wanted to make it more visible, which made it show up in search results.

Personally I find logic that relies on tiddler titles to be brittle, for example it all falls apart if you drag and drop a node from one root tiddler to another.

1 Like

While we are on the topic, to exclude individual nodes from the Recent tab in the side bar:

  • edit the tiddler $:/core/ui/SideBar/Recent
  • replace the content with <$macrocall $name="timeline" format={{$:/language/RecentChanges/DateFormat}} subfilter="get-stream-root[]"/>
2 Likes

thank you everyone ,this is really great support

@saqimtiaz the variation you shared is actually what worked best for me ,thank you for your help:)
@etardiff thank you for your solution , it works too,i opted for saqim’s as it is integrated in the standard serach as a secondary sub tab which is very convenient :slight_smile: (btw i am very familiar with kin filter, you might want to check tagstree filter and ancestors filter,. they do the same thing but for some reason they perfrom way more faster)

thanks again for all your help:)

1 Like