exclude search term

273 views
Skip to first unread message

tobaisch

unread,
Dec 27, 2017, 12:48:26 AM12/27/17
to tiddl...@googlegroups.com
a short simple question:
How can I exclude a search term from the standard
search in the sidebar ?
"-" and "!" do not work.
thx
regards
tob

Mal

unread,
Dec 27, 2017, 5:40:50 AM12/27/17
to TiddlyWiki
tob,

I don't think it's possible to carry out a more complex search in the standard search box.  You could use the advanced search and build a suitable filter expression.

For example: "[search[apples]!search[oranges]]"

Regards,

Mal


tobaisch

unread,
Dec 27, 2017, 11:02:32 AM12/27/17
to TiddlyWiki
for real?
it's a pity.
regards,
tob

Mal

unread,
Dec 27, 2017, 7:39:54 PM12/27/17
to TiddlyWiki
tob,

I probably should have pointed out that you get to the advanced search by clicking on the magnifying glass icon next to the standard search box. Then select the "filter" tab and enter your filter expression into the box.

It's not really much harder than using the standard search and gives you the flexibility you're after.

Regards,

Mal

tobaisch

unread,
Dec 27, 2017, 11:45:07 PM12/27/17
to tiddl...@googlegroups.com
It's not really much harder than using the standard search and gives you the flexibility you're after.
 
I have a different opinion.
the standard search is always fixed in the sidebar. A huge difference!
The search results do not hide the content I am currently working on.
:)
Regards
Tob

Eric Shulman

unread,
Dec 28, 2017, 3:41:50 AM12/28/17
to TiddlyWiki
That's why the sidebar was invented. :)

You can add the filter search interface into the sidebar tabs.  Here are the exact steps:

1) Press the magnifying glass next to the standard sidebar search input to open $:/AdvancedSearch
2) From the $:/AdvancedSearch *shadows* tab, search for "AdvancedSearch/Filter"
3) Select "$:/core/ui/AdvancedSearch/Filter" from the search results to display that tiddler in the story
4) Edit that tiddler and add a tag: "$:/tags/SideBar"
5) You will now have a "Filter" tab in the sidebar.  Select that tab to perform filter searches with the results displayed in the sidebar.

Extra goodness... there is a down-arrow button next to the filter search input.  This button displays a dropdown list of pre-defined filter seaches.  To add your own pre-defined filter searches to this dropdown list:

1) Create a new tiddler (e.g., "MyFilterSearch") tagged with "$:/tags/Filter"
2) Add a "description" field, e.g., "Apples not Oranges"
3) Add a "filter" field containing the filter search syntax, e.g., "[search[apples]!search[oranges]]"
4) Add a "list-before" field.  Do not enter a value for this field.  This will cause the entry to automatically appear before all other pre-defined filters in the list.

You can create as many custom filter searches as you like by following the above steps again, using different titles, descriptions, and filter field values.

One display issue to fix:

The list of pre-defined filters drops down to the RIGHT of the down-arrow button.  In the sidebar, this typically results in part of the list flowing off the right edge of the window, making it hard to use since you can only see part of the filter descriptions.  To fix this:

1) Edit the shadow tiddler "$:/core/ui/AdvancedSearch/Filter/FilterButtons/dropdown"
2) Change this line:
<$reveal state=<<qualify "$:/state/filterDropdown">> type="popup" position="belowleft" animate="yes">
to
<$reveal state=<<qualify "$:/state/filterDropdown">> type="nomatch" text="" position="belowleft" animate="yes">
This will shift the drop-down so it appears directly under the filter search input, rather than below the down-arrow button.

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals

Mal

unread,
Dec 28, 2017, 5:57:58 AM12/28/17
to TiddlyWiki
Eric,

A brilliant and comprehensive answer, as always!

Regards,

Mal

tobaisch

unread,
Dec 28, 2017, 9:13:23 PM12/28/17
to TiddlyWiki
Thanks Eric,
I did something similar too.
I've added predefined lists of my most common queries as sidebar vertical tabs.
Your variant is a little more elegant. :)
Nevertheless, I think it's a pity that there is no exclude filter.
Such a "-" as with the Google search would be very comfortable.
I can not have everything
I'm already so excited about the tiddlywiki functionality and flexibility. That predominates.
Regards
Tob

TonyM

unread,
Dec 28, 2017, 11:23:14 PM12/28/17
to TiddlyWiki
Tobaisch,

Of course with sufficient desire you can build what you want in tiddlywiki.

Basically accept an input then rework it to make the filter in tiddlywiki terms.

The Below code provides a tag based search with +include and -exclude which could be adapted to search values

\define displaymyfilter()
<$list filter="[list[EditInput!!input]]" variable=item>
<$list filter="[<item>!prefix[+]!prefix[-]]" variable=tagfilter>
[tag[<<tagfilter>>]] 
</$list>
<$list filter="[<item>prefix[+]]+[removeprefix[+]]" variable=tagfilter>
+[tag[<<tagfilter>>]] 
</$list>
<$list filter="[<item>prefix[-]]+[removeprefix[-]]" variable=tagfilter>
-[tag[<<tagfilter>>]] 
</$list>
</$list>
\end

<$edit-text tiddler=EditInput field="input"/>

;Instructions: 
:Place Tags in search order; left to right: 
:space separated,
:No leading + or - For include if so tagged
:leading + for must include if so tagged
:leading - for must exclude if so tagged
:note: Logically + must proceed -  in many cases
:surround tags `[[with spaces]]` like this.

see [[EditInput]]

!!Matching tiddlers
<$wikify name=setfilter text="<<displaymyfilter>>">
<$macrocall $name="list-links" filter=<<setfilter>> />
</$wikify>



tobaisch

unread,
Dec 29, 2017, 5:24:48 PM12/29/17
to TiddlyWiki


The Below code provides a tag based search with +include and -exclude which could be adapted to search values

Thanks TonyM,
I tried to adapted your code to change the standard search.
It did not really work, but it does not matter.
I manage my predefined lists quite well so far.
Maybe the "-" function will be added later as a standard in the TiddlyWiki.
Regards
Tob

 

TonyM

unread,
Dec 29, 2017, 5:50:18 PM12/29/17
to TiddlyWiki
Rewritten a as a search tool, not tested comprehensively but seems to work

\define displaymysearch()
<$list filter="[list[EditInput!!input]]" variable=item>
<$list filter="[<item>!prefix[+]!prefix[-]]" variable=searchfilter>
[search[<<searchfilter>>]] 
</$list>
<$list filter="[<item>prefix[+]]+[removeprefix[+]]" variable=searchfilter>
+[search[<<searchfilter>>]] 
</$list>
<$list filter="[<item>prefix[-]]+[removeprefix[-]]" variable=searchfilter>
-[search[<<searchfilter>>]] 
</$list>
</$list>
\end

<$edit-text tiddler=EditInput field="input"/>

;Instructions: 
:Place Text in search order; left to right: 
:space separated,
:No leading + or - For include if so found
:leading + for must include if so found
:leading - for must exclude if so found
:note: Logically + must proceed -  in many cases
:surround text `[[with spaces]]` like this?

;see [[EditInput]]
:<<displaymysearch>>

!!Matching tiddlers
<$wikify name=setfilter text="<<displaymysearch>>">
<$macrocall $name="list-links" filter=<<setfilter>> />
</$wikify>

Regards
Tony
Reply all
Reply to author
Forward
0 new messages