[tw5] custom search bar reaults span broken

I created a custom search bar results for the main search bar. Everything works except each search result shows a ’ ’ at their end. This only happens in the second list, which I replaced the second filter field transclusion with a macro. So that may be the issue-- the macro breaking the span.

Attached is a json file with the 2 tiddlers needed to test it at TW . com

Also let me know if i incorporated the regexp (second list for searching beginnings of words, the first search beginning of title only) properly. I’m still figuring out why the count isn’t registering properly

As always, thank you in advance.

$:/.wt/ModSearchResultListTitle

\define var-wordbegins() [!is[system]search:title,caption:regexp[\b$(srchbrval)$]sort[title]limit[250]]
\define searchResultList()
<$set name="srchbrval" value=<<userInput>>>
//<small>Beginning of title</small>//

<$list filter="[<userInput>minlength[1]]" variable="ignore">
<$list filter={{{ [<configTiddler>get[first-search-filter]] }}}>
<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[<searchListState>get[text]] +[then[]else[tc-list-item-selected]] }}}>
<$transclude tiddler="$:/.wt/ui/ListItemTemplateTitleCaption"/>
</span>
</$list>
</$list>
<hr style="margin:5px auto 0px;"/>//<small>Any word in title</small>//<hr style="margin:0px auto;"/>
<$list filter="[<userInput>minlength[1]]" variable="ignore">
<$list filter=<<var-wordbegins>>
<span class={{{[<currentTiddler>addsuffix[-secondaryList]] -[<searchListState>get[text]] +[then[]else[tc-list-item-selected]] }}}>
<$transclude tiddler="$:/.wt/ui/ListItemTemplateTitleCaption"/>
</span>
</$list>
</$list>
</$set>
\end
<small>Searches titles & (alternate titles) only</small><br/>
<<searchResultList>>

$:/.wt/ModSearchResultListTitle

\define var-wordbegins() [!is[system]search:title,caption:regexp[\b$(srchbrval)$]sort[title]limit[250]]
\define searchResultList()
<$set name=“srchbrval” value=<>>
//Beginning of title//

<$list filter="[minlength[1]]" variable=“ignore”>
<$list filter={{{ [get[first-search-filter]] }}}>
<span class={{{[addsuffix[-primaryList]] -[get[text]] +[then[]else[tc-list-item-selected]] }}}>
<$transclude tiddler="$:/.wt/ui/ListItemTemplateTitleCaption"/>

</$list>
</$list>


//Any word in title//
<$list filter="[minlength[1]]" variable="ignore"> <$list filter=<> <span class={{{[addsuffix[-secondaryList]] -[get[text]] +[then[]else[tc-list-item-selected]] }}}> <$transclude tiddler="$:/.wt/ui/ListItemTemplateTitleCaption"/> \end Searches titles & (alternate titles) only
<>
first-search-filter:

[!is[system]search:title,caption:literal,anchored<userInput>sort[title]limit[250]]

second-search-filter:

[!is[system]search:title,caption:regexp<var-wordbegins>sort[title]limit[250]]

$:/.wt/ui/ListItemTemplateTitleCaption
<$link><$view field="title"/> <$list filter="[has[caption]]">(<$view field="caption"/>)
```

modifiedsearchbarresults.json (1.84 KB)

1 Like