Captions and searching

Some time ago, I posted a query regarding captions and search results and was provided with an edit to a shadow tiddler to show captions instead of titles. In my case, tiddler titles are of the form, MGA1012345, instead of something meaningful like, South Australia, Elizabeth - 25 Pounder Naval Gun.

This is working well but there is an upcoming issue I can see when using the search box. The results link will display captions, but in my case, captions might be just one word, say History, for a tiddler that records the history of a gun whose tiddler is titled MGA1012345 and whose history tiddler is titled MGA1012345-History with the caption History. I implemented single word captions and the captions are used to label tabs on the parent gun record.

So I can foresee a search result containing many entries titled History with the user having no way to differentiate between them without clicking each one in turn until they find the gun they are looking for.

I know the issue is tiddler naming but I can not think of a way round without making the history tiddler title as long ans the gun title, ie, South Australia, Elizabeth - 25 Pounder Naval Gun-History, which will make the search result essentially unusable on mobile devices.

The only way out that I can envisage is to implement my own search function and hide the wiki one.

Anyone got any other ideas I could ponder?

bobj

you could use the existing advanced search filter tab, or clone, with a custom list item template that adds to each listed item full title, tags or any subject specific fields.

As I understand it the search is working just not exposing what the user needs to see to differentiate on item from another, so it makes sense to use the listitem to expose that info.

  • create a new list item template, the existing one is used in many places.

thanks @TW_Tones you have given me something to think about.

bobj

You can have a closer look at Customising search results

It points to $./core/ui/DefaultSearhResultList, which is described in “Customising search results”

It points to <$transclude tiddler="$:/core/ui/ListItemTemplate"/> which is the item template that is shown in the search results.

It contains the following code, that creates a link to the tiddler title.

<div class="tc-menu-list-item"><$link /></div>

So you can change the link-widget to use the currentTiddler variable as the link target, and any other text / field you want to show in the link.

It could be changed to the following code, to show the caption field instead of the title, but falls back to the title if the caption does not exist.

\whitespace trirm
<div class="tc-menu-list-item">
  <$link to=<<currentTiddler>> >
    <$let tv-wikilinks="no">
      <$transclude $field="caption" $mode="inline">
        <$transclude $field="title" $mode="inline"/>
      </$transclude>
    </$let>
  </$link>
</div>

tv-wikilink=“no” is needed, to avoid CamelCase linking inside the link-widget link.

Thank you @pmario for your directions. I will follow them up and see where they get me.

Bobj