How to save new filters as templates and add drag and drop functionality to search results of advanced search- filter tab

I have two objectives

  • Save new filters as templates in the advanced search- filter tab
  • add drag and drop functionality to search results of advanced search- filter tab
  1. Save new filters as templates in the advanced search- filter tab
    I created a tiddler titled $:/core/ui/AdvancedSearch/Filter/FilterButtons/Add new filter and tagged it with $:/tags/AdvancedSearch/FilterButton

Text field contains code given below


<$button class="tc-btn-invisible" > <$action-createtiddler $basetitle="$:/core/Filters/" tags="$:/tags/Filter" $template="$:/core/Filters/template" filter={{$:/temp/advancedsearch}} > 	<$action-sendmessage $message="tm-edit-tiddler" $param=<<createTiddler-title>>/> </$action-createtiddler> new filter</$button> 

It working and I want a few more additions. Most of my filter searches have this format [field:fieldname[fieldvalue]]. I want the newly created filter template tiddler to have a field called description whose field-value should be fieldname in the filter used. Also tiddler should have a title along this format $:/core/Filters/fieldname

  1. Add drag and drop functionality to search results of advanced search- filter tab

For this I am using the filter-pill macro from this discussion about field macro

<<filter-pill "filter-used" """drag and drop""" "" "" >>

Here the filter-used is equal to {{$:/temp/advancedsearch}}, but using which syntax should I use it in the filter-pill macro.

Here is the demo

How to use $:/temp/advancedsearch in this macro instead of manually typing the filter ?

I have planned to create a save filter button in the advanced search filter tab, so I may do it shortly and share back.

  • On a click it would create a tiddler containing the current filter and open it for edit so it can be named.

On the second objective, adding drag and drop to the “search results of advanced search- filter tab” to me is not appropriate and somewhat difficult to achieve in the filter tab. I would suggest a new tab designed to collect results from one or more uses of a filter and your drag and drop feature.

  • We could add a button to the advanced search filter tab to add the results list to a working list, allowing this to be done multiple times.
  • Then click on the working list tab to;
    • Reorder
    • Remove items
    • Drag and drop additional titles
    • Select a subset
    • Copy a list of titles

What do you think

I want this feature badly since I use it so frequently. I have seen something similar in Commander plug in. Tried my luck in porting it to advanced search, but couldn’t succeed today. Will try once more in a few days.

This can be already done by the field macro already created in this discussion - How to create a field macro similar to the tag macro - #23 by arunnbabu81

I just want to know how to use the $:/temp/advancedsearch in that macro

see https://tiddlytools.com/#TiddlyTools%2FSearch%2FSaveFilter

Just drag-and-drop this tiddler into your own TiddlyWiki. It automatically adds a “save filter” button to the $:/AdvancedSearch > Filters tab.

In that tab, clicking the button shows a popup that allows you to enter a tiddler tile, a filter definition (defaults to the current search input), and a description (also defaults to the current search input). Enter the name of a tiddler to create and press the “save filter” button. The specified tiddler will be created and tagged with “$:/tags/Filter” so it will appear in the dropdown list in $:/AdvancedSearch > Filters, ready to be selected and applied.

2 Likes

Nice work Eric, using the Popup dialogue very good, and added to my top tools.

And a bookmarklet for it made.

Thanks

Thank you @EricShulman. Never knew such a tool was already existing.

@TW_Tones I was able to solve this also based on this old post in field macro thread by @EricShulman. See the code below.

<$button dragFilter={{$:/temp/advancedsearch/input}}>
   drag n drop
</$button>