Add duplicates checkbox to advanced filter search

This commit is contained in:
Jeremy Ruston
2026-01-31 18:11:52 +00:00
parent f41ed1c88c
commit d2faad2c58
4 changed files with 21 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ title: $:/language/Search/
DefaultResults/Caption: List
Filter/Caption: Filter
Filter/Hint: Search via a [[filter expression|https://tiddlywiki.com/static/Filters.html]]
Filter/AllowDuplicates: Allow duplicate results
Filter/Matches: //<small><<resultCount>> matches</small>//
Matches: //<small><<resultCount>> matches</small>//
Matches/All: All matches:

View File

@@ -96,13 +96,24 @@ caption: {{$:/language/Search/Filter/Caption}}
</$list>
</div>
<div class="tc-advanced-search-options">
<$checkbox tiddler="$:/config/Search/AllowDuplicates" field="text" checked="yes" unchecked="no" default="yes">
<$text text=" "/><<lingo Filter/AllowDuplicates>>
</$checkbox>
</div>
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="" tag="div" class="tc-search-results">
<$set name="resultCount" value="<$count filter={{$:/temp/advancedsearch}}/>">
<$let
filter-allow-duplicates="::defaultprefix:all [subfilter{$:/temp/advancedsearch}]"
filter-deduplicate="::defaultprefix:or [subfilter{$:/temp/advancedsearch}]"
currentFilter={{{ [{$:/config/Search/AllowDuplicates}match[yes]then<filter-allow-duplicates>else<filter-deduplicate>] }}}
resultCount={{{ [subfilter<currentFilter>count[]] }}}
>
<p><<lingo Filter/Matches>></p>
<$list filter={{$:/temp/advancedsearch}}>
<$list filter="[subfilter<currentFilter>]">
<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[[$:/temp/advancedsearch/selected-item]get[text]] :and[then[]else[tc-list-item-selected]] }}}>
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
</span>
</$list>
</$set>
</$let>
</$reveal>

View File

@@ -0,0 +1,2 @@
title: $:/config/Search/AllowDuplicates
text: yes

View File

@@ -940,6 +940,10 @@ button.tc-btn-invisible.tc-remove-tag-button {
width: 60%;
}
.tc-advanced-search .tc-advanced-search-options input {
width: auto;
}
.tc-search a svg {
width: 1.2em;
height: 1.2em;