I’m in the midst of coding a change regarding the list of relationships in the sidebar tab.
In the “before” version, every relationship is retrieved once, and the link for each relationship shows the people in the relationship sorted by their names. This means searching via scanning the list means looking at names of both people in every relationship…
In the “after” version, every relationship is listed twice: once as “Person A” and “Person B”, and once as “Person B” and “Person A”. And then all of those relationships are sorted alphabetically. So if you are scanning for a particular person, you can just look at the first person in all relationships.
A picture being worth a thousand words, here is an example in which we would be scanning for a particular “Michel”…
Before:
After:
Related code, if you are interested in that …
Before:
\define extra() <br><div style="margin-left:20px;margin-top:-5px;font-size:0.75em;">{{{ [{!!title}get[dob]] [{!!title}get[dod]addprefix[ ➡ ]] +[join[]] +[addprefix[ (]] +[addsuffix[)]] || txt }}}</div>
<$button>
<$action-createtiddler $basetitle={{{ [tag[m]nsort[]last[]add[1]else[1]] }}} tags="m">
<$action-navigate $to=<<createTiddler-title>>/>
</$action-createtiddler>
âž• Add a Relationship
</$button>
<hr>
''Filter: '' <$edit-text tiddler="$:/temp/MarriagesFilter" tag="input" default=""/>
<hr>
<$let r={{{ [[(?i)]] [{$:/temp/MarriagesFilter!!text}] +[join[]] }}}>
<$list filter="[tag[p]regexp<r>sort[]tagging[]tag[m]]">
<$link to={{!!title}}><$text text={{{ [{!!title}tags[]tag[p]search-replace:g[_],[ ]sort[]join[ 🧑‍🤝‍🧑 ]else[New marriage]] }}}/></$link><<extra>>
<hr style="margin:1px;border:1px dashed #d7d7d7">
</$list>
</$let>
After:
\define extra() <br><div style="margin-left:20px;margin-top:-5px;font-size:0.75em;">{{{ [<m>get[dob]] [{!!title}get[dod]addprefix[ ➡ ]] +[join[]] +[addprefix[ (]] +[addsuffix[)]] || txt }}}</div>
<$button>
<$action-createtiddler $basetitle={{{ [tag[m]nsort[]last[]add[1]else[1]] }}} tags="m">
<$action-navigate $to=<<createTiddler-title>>/>
</$action-createtiddler>
âž• Add a Relationship
</$button>
<hr>
''Filter: '' <$edit-text tiddler="$:/temp/MarriagesFilter" tag="input" default=""/>
<hr>
<$let r={{{ [[(?i)]] [{$:/temp/MarriagesFilter!!text}] +[join[]] }}}>
<$list variable=p1 filter="[regexp<r>tag[p]sort[]]">
<$list variable=p2 filter="[<p1>tagging[tag[m]tags[]tag[p]!match<p1>sort[]]">
<$list variable=m filter="[tag<p1>tag[m]] :intersection[tag<p2>tag[m]]">
<$link to=<<m>>><$text text={{{ [<p1>search-replace:g[_],[ ]] [<p2>search-replace:g[_],[ ]addprefix[ 🧑‍🤝‍🧑 ]] +[join[]] }}}/></$link><<extra>>
<hr style="margin:1px;border:1px dashed #d7d7d7">
</$list>
</$list>
</$list>
</$let>