TiddlyTools/Search/Tags tweak?

Hi everyone but especially @EricShulman

Ok I found this TiddlyTools/Search/Tags ( TiddlyTools for TW v5.4.0 — Small Tools for Big Ideas!™ )

Then I tweaked it as below so the tags would show in one table cell and the tiddlers in the other, side-by-side.

\define config() $:/config/TiddlyTools/FindTags

\define show(bool)
<$let transclusion=$bool$><$set name=txt filter="[enlist{!!items}sort[]addprefix[<<tag ]addsuffix[>>]join[ $bool$ ]]"><$wikify name=txt text=<<txt>>><$list filter=<<filter>>><$link/><br></$list>
\end

<$tiddler tiddler=<<config>>>

<$let tids={{{ [<config>get[shadows]match[yes]then[tiddlers]else[tiddlers]] }}}>

<table>
<tr><td width="55%"><$list filter="[all<tids>tags[]!prefix[$:/]] [enlist{!!items}] +[sort[]]" variable=item>
	<nobr><$checkbox listField=items checked=<<item>>> <$text text=<<item>>/></$checkbox></nobr>
</$list></td><td><$list filter="[enlist{!!items}count[]] -0" variable=none>
<$wikify name=filter text="[all[<<tids>>]<$list filter='[enlist{!!items}]'>tag[<<currentTiddler>>]</$list>] +[sort[]]"><<show AND>></$wikify>

But I am wondering if it could be combined with a list-search for the tag column, whether [Tobias’]( tb5 — Welcome ) or [Mohammad’s]( KISS Macro to Create a List-Search ) or something equivalent. The list-search wouldn’t check or uncheck the tag checkboxes, it would just help the user get quickly to the tag(s) he wants to check. If the list of tags were long it could slide off the page, requiring scrolling up and down.

Apparently this request inspired no one…this may be the only barrier left to word domination…to come so close…

Give this a try:

\define temp() $:/temp/FindTags
match tags:
<$edit-text tiddler=<<temp>> field=match/>
<$button>reset<$action-deletetiddler $tiddler=<<temp>>/></$button>
<$tiddler tiddler=<<temp>>>
<table>
<tr valign="top"><td>
	 <$list filter="[tags[]!is[system]search:title:some{!!match}] [enlist{!!items}] +[sort[]]" variable=item>
		<nobr><$checkbox listField=items checked=<<item>>> <$text text=<<item>>/></$checkbox></nobr><br>
	 </$list>
</td><td>
	<%if [{!!items}!match[]] %>
		<$wikify name=filter text="[all[tiddlers]<$list filter='[enlist{!!items}]'>tag[<<currentTiddler>>]</$list>] +[sort[]]">
		<$list filter=<<filter>>><$link/><br></$list>
		</$wikify>
	<%else%>
		Please select some tags...
	<%endif%>
</td></tr>
</table>

Notes:

  • Since this is now very different from my TiddlyTools/Search/Tags code, I’ve changed the “config” tiddler to use $:/temp/FindTags instead of $:/config/TiddlyTools/FindTags. This has the added advantage of being automatically discarded when saving your TiddlyWiki so that you always start fresh.
  • I also added a “reset” button to manually delete the $:/temp/FindTagstiddler. This resets the “match” and “items” (selected tags) so you can start fresh whenever you want during the current browser session.
  • The search:title:some{!!match} filter operator is used to trim the list of tags.
  • Since you don’t actually show the “tag1 AND tag2 AND …” output, I removed the show() macro and moved the <$list filter=<<filter>>><$link/><br></$list> code “inline” in the table.
  • I also removed the <$let tids=...> code, since it isn’t needed because you are always searching in “tiddlers” without “shadows”.

enjoy,
-e

Wow! that is perfect! Thank you Eric!! World domination is again within my grasp…

Hello Eric,

is it possible to make the left column scrollable and keep the right side (search results for the selected tags) static as long as it doesn’t exceed the max-height?
This way, the “search results” are always visible.

If the right column exceeds the max-height, a scrollbar should appear.

Thx, Stefan

Add style="max-height:50vh;overflow:auto;" to each <td>
and wrap the content within each <td> with <div style="max-height:50vh;">, like this:

\define temp() $:/temp/FindTags
match tags:
<$edit-text tiddler=<<temp>> field=match/>
<$button>reset<$action-deletetiddler $tiddler=<<temp>>/></$button>
<$tiddler tiddler=<<temp>>>
<table><tr valign="top">
<td style="max-height:50vh;overflow:auto;">
	<div style="max-height:50vh;">
	<$list filter="[tags[]!is[system]search:title:some{!!match}] [enlist{!!items}] +[sort[]]" variable=item>
		<nobr><$checkbox listField=items checked=<<item>>> <$text text=<<item>>/></$checkbox></nobr><br>
	</$list>
	</div>
</td>
<td style="max-height:50vh;overflow:auto;">
	<div style="max-height:50vh;">
	<%if [{!!items}!match[]] %>
		<$wikify name=filter text="[all[tiddlers]<$list filter='[enlist{!!items}]'>tag[<<currentTiddler>>]</$list>] +[sort[]]">
		<$list filter=<<filter>>><$link/><br></$list>
		</$wikify>
	<%else%>
		Please select some tags...
	<%endif%>
	</div>
</td>
</tr></table>

-e

Perfect!
Thanks Eric!

Eric, this is a great tool, especially with the new tweak in response to @StS . It offers users a quick way to search for tiddlers by tag. It reduces the need to create list-links and list widgets. And it is a clean looking interface.

Are you going to offer it on TiddlyTools?

I am asking because I would like to add it to my documenting TW site but currently it exists only as a tiddler in my reading file. I called it “$:/TiddlyTools/ListSearchFilterMultipleTags” for lack of a better title. But I would rather point to an official location on TiddlyTools if you think it is worthy of inclusion there.

I added one tweak to this. I added a way to further filter by title after filtering by tags. It depends on Tobias Beer’s list-search macro.

\define temp() $:/temp/FindTags
match tags:
<$edit-text tiddler=<<temp>> field=match/>
<$button>reset<$action-deletetiddler $tiddler=<<temp>>/></$button>
<$tiddler tiddler=<<temp>>>
<table><tr valign="top">
<td style="max-height:50vh;overflow:auto;">
	<div style="max-height:50vh;">
	<$list filter="[tags[]!is[system]search:title:some{!!match}] [enlist{!!items}] +[sort[]]" variable=item>
		<nobr><$checkbox listField=items checked=<<item>>> <$text text=<<item>>/></$checkbox></nobr><br>
	</$list>
	</div>
</td>
<td style="max-height:50vh;overflow:auto;">
	<div style="max-height:50vh;">
After filtering by tags, filter here by title.
	<%if [{!!items}!match[]] %>
		<$wikify name=filter text="[all[tiddlers]<$list filter='[enlist{!!items}]'>tag[<<currentTiddler>>]</$list>] +[sort[]]">
<$macrocall $name="list-search" filter=<<filter>> />
</$wikify>
	<%else%>
		Please select some tags...
	<%endif%>
	</div>
</td>
</tr></table>

I combined this with prefixes for tags to distinguish (and filter) the tags by topic (#), domain (@) and meta (.).

The code posted here is essentially a use-case specific subset of TiddlyTools/Search/Tags. The significant differences:

  • addition of a “match tags” text input (to narrow the list of tag checkboxes)
  • elimination of the “ include shadows” option
  • elimination of the “OR” tiddler list
  • the use of a table instead of blockquotes for the display

Your use-case is sufficiently different that I think the best approach is to keep the existing TiddlyTools/Search/Tags code “as-is”, except for adding the “match tags” handling.

The only thing I would request is that you give your implementation a different name that does NOT contain “TiddlyTools”, as that implies that it is something I have published on my site. Just call it $:/ListSearchFilterMultipleTags.

If you want to give me some credit, you can add an HTML comment within the code that says something like “Derived from TiddlyTools/Search/Tags with the assistance of Eric Shulman”

-e

Thanks, Eric, I will do that.

Thank you all for this little tools very useful. I just added a limitation to the width of the 1st column. I have a wiki with a pretty long tag and I could’nt see enough of the titles…

<table style="table-layout: fixed; width: 100%;">
  <tr valign="top">
    <td style="max-height:50vh; overflow:auto; width:35%; word-wrap: break-word; overflow-wrap: break-word;">
      <div style="max-height:50vh;">
        <$list filter="[tags[]!is[system]search:title:some{!!match}] [enlist{!!items}] +[sort[]]" variable=item>
          <nobr><$checkbox listField=items checked=<<item>>> <$text text=<<item>>/></$checkbox></nobr><br>
        </$list>
      </div>
    </td>
    <td style="max-height:50vh; overflow:auto; width:70%;">
      <div style="max-height:50vh;">
        Après les tags, filtre ici par titre.
        <%if [{!!items}!match[]] %>
          <$wikify name=filter text="[all[tiddlers]<$list filter='[enlist{!!items}]'>tag[<<currentTiddler>>]</$list>] +[sort[]]">
            <$macrocall $name="list-search" filter=<<filter>> />
          </$wikify>
        <%else%>
          Sélectionne des tags...
        <%endif%>
      </div>
    </td>
  </tr>
</table>

and some french translations…

I made the same change to the width! Great minds think alike.