tags: $:/tags/Macro
title: $:/plugins/bimlas/locator/macros/locator-search
type: text/vnd.tiddlywiki

\define locator-search()
  <!-- Hide internal macros, do not make them globally available -->
  <$importvariables filter="[all[tiddlers+shadows]prefix[$:/plugins/bimlas/locator/macros/]]">
    <$vars
      contextState="$:/state/bimlas/locator/search/context/"
      intersectionState="$:/state/bimlas/locator/search/intersection/"
      differenceState="$:/state/bimlas/locator/search/difference/"
      filterContextItems="[subfilter<filter-search-context>search{$(searchTiddler)$}]"
      recursiveFilteringAvailable="yes"
    >

      {{$:/plugins/bimlas/locator/templates/search-toolbar}}

      <$list filter="[subfilter<filterContextItems>count[]]" variable="resultCount" template="$:/language/Search/Matches"/>

      {{$:/plugins/bimlas/locator/templates/fields-filter}}

      //<small>{{$:/language/Search/Matches/Title}}</small>//

      <$list filter="[subfilter<filterContextItems>search:title{$(searchTiddler)$}limit[250]]" template="$:/core/ui/ListItemTemplate"/>

      //<small>{{$:/language/Search/Matches/All}}</small>//

      <$list filter="[subfilter<filterContextItems>limit[250]]" template="$:/core/ui/ListItemTemplate"/>

    </$vars>
  </$importvariables>
\end
