1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Suppress search results if search string is too short

Fixes #2603
This commit is contained in:
Jermolene 2016-10-11 09:27:26 +01:00
parent e724bc6120
commit 989cee5059
7 changed files with 33 additions and 1 deletions

View File

@ -8,6 +8,7 @@ Matches: //<small><<resultCount>> matches</small>//
Matches/All: All matches:
Matches/Title: Title matches:
Search: Search
Search/TooShort: Search text too short
Shadows/Caption: Shadows
Shadows/Hint: Search for shadow tiddlers
Shadows/Matches: //<small><<resultCount>> matches</small>//

View File

@ -21,6 +21,8 @@ caption: {{$:/language/Search/Shadows/Caption}}
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">
<$list filter="[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">
<$set name="resultCount" value="""<$count filter="[all[shadows]search{$:/temp/advancedsearch}] -[[$:/temp/advancedsearch]]"/>""">
<div class="tc-search-results">
@ -33,6 +35,8 @@ caption: {{$:/language/Search/Shadows/Caption}}
</$set>
</$list>
</$reveal>
<$reveal state="$:/temp/advancedsearch" type="match" text="">

View File

@ -20,6 +20,7 @@ caption: {{$:/language/Search/Standard/Caption}}
</$linkcatcher>
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">
<$list filter="[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">
<$set name="searchTiddler" value="$:/temp/advancedsearch">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]butfirst[]limit[1]]" emptyMessage="""
<$list filter="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]">
@ -29,4 +30,5 @@ caption: {{$:/language/Search/Standard/Caption}}
<$macrocall $name="tabs" tabsList="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]" default={{$:/config/SearchResults/Default}}/>
</$list>
</$set>
</$list>
</$reveal>

View File

@ -21,6 +21,8 @@ caption: {{$:/language/Search/System/Caption}}
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">
<$list filter="[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">
<$set name="resultCount" value="""<$count filter="[is[system]search{$:/temp/advancedsearch}] -[[$:/temp/advancedsearch]]"/>""">
<div class="tc-search-results">
@ -33,6 +35,8 @@ caption: {{$:/language/Search/System/Caption}}
</$set>
</$list>
</$reveal>
<$reveal state="$:/temp/advancedsearch" type="match" text="">

View File

@ -17,9 +17,12 @@ title: $:/core/ui/SideBarLists
{{$:/core/images/close-button}}
</$button>
<$button popup=<<qualify "$:/state/popup/search-dropdown">> class="tc-btn-invisible">
{{$:/core/images/down-arrow}}
<$list filter="[{$:/temp/search}minlength{$:/config/Search/MinLength}limit[1]]" variable="listItem">
<$set name="resultCount" value="""<$count filter="[!is[system]search{$(searchTiddler)$}]"/>""">
{{$:/core/images/down-arrow}} {{$:/language/Search/Matches}}
{{$:/language/Search/Matches}}
</$set>
</$list>
</$button>
</$reveal>
<$reveal state="$:/temp/search" type="match" text="">
@ -33,8 +36,12 @@ title: $:/core/ui/SideBarLists
<$reveal tag="div" class="tc-block-dropdown tc-search-drop-down tc-popup-handle" state=<<qualify "$:/state/popup/search-dropdown">> type="nomatch" text="" default="">
<$list filter="[{$:/temp/search}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">
{{$:/core/ui/SearchResults}}
</$list>
</$reveal>
</$reveal>

View File

@ -0,0 +1,3 @@
title: $:/config/Search/MinLength
3

View File

@ -0,0 +1,11 @@
created: 20161011074235805
modified: 20161011074235805
tags: [[Hidden Settings]]
title: Hidden Setting: Search Minimum Length
type: text/vnd.tiddlywiki
<<.from-version "5.1.14">> Controls the minimum length of a search string before results are displayed.
Defaults to "3".
$:/config/Search/MinLength