Search for current tiddler in title of other tiddlers but only after specific text

Explanation: I will have tiddler titles like

Booktitle (Authorlastname) ch 1 p 34 /i/ Matthew 24, NT use of OT

Everything before /i/ has to do with the source. Everything after has to do with the topic.

I would like the tiddler Matthew to list all tiddlers that contain Matthew anywhere after /i/ but not before, and for the tiddler NT use of OT to list all tiddlers that contain NT use of OT anywhere after ‘/i/’ but not before.

I got to <$list filter="[search::literal[/i/]search:title<currentTiddler>!search:title[/n/]sort[title]] -[is[current]]> but this searches anywhere in the tiddler title. This would include tiddlers where the word Matthew is found before /i/. I would like to avoid this, as I will certainly have sources that include the word Matthew.

I could have it search for the string “/i/ plus current tiddler” (not sure how to write that) and that would work for Matthew in the case above but not for NT use of OT since there is intervening text.

How might I write the filter?

I would put the list filter in a global macro to place in tiddlers that are topics (Matthew, NT use of OT. (I already have a working macro to do the same for sources which searches for the current title as a prefix.)

Hi Dave,

Looks like this could do the job:

{{{ [all[tiddlers]] :filter[<currentTiddler>split[/i/]butfirst[]search:title:caseinsensitive<..currentTiddler>] }}}

You might want to change search operator suffix as per documentation in order to suit your precise use case regarding multi-word tiddler title (if your tiddler title is “John Doe”, would you like to find only “John Doe” in titles, or also “John” and “Doe”?). For now it only searches case-insensitively and would also match tiddlers like “John and Jane Doe”.

Hope this helps,

Fred

(post deleted by author)

Sorry, I made a mistake in my first reply, so I deleted it. It does in fact, do what I needed it to do! Thanks, Fred!

1 Like

This version uses a function instead:

title: NT use of OT

\function match.2nd(txt) [all[tiddlers]] :filter[<currentTiddler>split[/i/]nth[2]search<txt>]

!! Matthew 24

<<list-links filter:"[match.2nd[Matthew 24]]" >>

!! {{!!title}} (using current title)

<<list-links filter:"[match.2nd{!!title}]" >>

Matthew 24

NT use of OT (using current title)

This varies from Fred’s suggestion by using nth[2] instead of butfirst[]. It probably doesn’t matter at all to you, but the difference is that if there are multiple /i/ separated sections, Fred’s checks all but the first, and mine checks only the second.

Like Fred, I ignored all the fiddling you can do with search.

searchAfterI.json (842 Bytes)

1 Like

David, as I have argued I think needing to parse complex titles is not a great approach, but you have already made this choice. A small useful tip however is using split to divide a string for use;

[all[current]split[/i/]last[]] will return everything after, but not including the /i/

You could even use functions to capture this and reuse where ever needed for example;

\function get.tile.book() [all[current]spilt[/i/]first[]]
\function get.tile.reference() [all[current]spilt[/i/]last[]]

so you could use <<get.tile.book>> (may need to join[ ]) or ..[get.tile.book[]]

The above has not being tested, just a suggestion of an approach;

  • You may search against one half of the title only

functions do not use any backtick quotes.

I find this amusing given that I just performed a major refactoring of an in-progress wiki in order to remove much other metadata from my tiddler hierarchy and derive it all from the titles. I use this to find, for instance, that the parent of Policy1410(C) is Policy1410 whose own parent is one of the root tiddlers, Section1000 and to filter all tiddlers to find its direct children of Policy1410(C)(1), Policy1410(C)(2), Policy1410(C)(3), Policy1410(C)(4), Policy1410(C)(5), and Policy1410(C)(6). To each their own, I guess!

One nit: If there happens to be more than one instance of /i/, it will return only the content after the last one.

I will just clarify, I would change a wiki to my prefered approach at a high level by,

  • Make a batch process that allows me to list all tiddlers with the title parsed so I can check my parsing is corect then provide a button to bulk change the tiddlers.
  • Copy the title to the caption or other alt title
  • Parse the components of the title into one or more appropriate fields and or tags
  • Use a new simpler but unique title
  • Backup wiki and press go for a one time refactoring.

I think this is the point of using delimiters. It would have being foolish to;

  • Have used the same delimiter more than once in a title
  • Not maintain clear logical and rational rules in any compound string so it can be reversed
  • If doing batch refactoring look for these inconsistencies in the data and repair so a batch process works.
    • It is often a balance between manual and automatic processes based on the logic and statistics of the change. For example if there is only a dozen tiddlers to change it does not justify the effort to batch it, if there are too many exceptions as well, you may as well put asside an hour to “just do it”, which used to be said before Nike stole the term :nerd_face:

I think there are all sorts of exceptions to that.

One example: U.S. phone numbers are ten digits, universally grouped into sets of three, three, and four. There are several different ways these are formatted, but the two most common ones are (212) 867-5309 and 212-867-5309. That latter one repeats the delimiter -, but in an entirely reasonable manner. You can easily use it to find the area code, prefix, and line number. This format would be fine as a tiddler title, IMHO.

Still, I do agree with you that David seems to be trying to stuff way to much into the tiddler’s title. I would suggest a rethink of this idea. And if it’s far along, I would still suggest a rethink, combined with the batch approach to change you suggest.

Hi everyone

We were out on a visit so I couldn’t see the discussion until now. Lots of variant ways of doing this, it sounds like. Thanks for all the responses.

I would agree that normally tiddler titles shouldn’t be so long, but this setup allows for a really quick, logical workflow with the fewest steps possible.

To see what I did with Fred’s initial solution, see this file:

https://giffmex.org/experiments/interpretation.html

I will play around with the other solutions offered since then. I did happen to see Scott’s Policy1410 thread and thought it was amusing to see the similarities.

There will not be more than one instance of /i/. The /i/ is created with a new here button so there is no chance of messing it up. Also, not sure why batch processes would be necessary. I am just creating individual notes after reading a chapter. The /i/ stands for intersection. The intersection tiddlers link a source plus page number with a topic or topics. So the source and topic tiddlers are short and readable. The intersection tiddlers are long but…well, you will see in the link above how I used them. Please at least read “Workflow Notetaking” to see how easy my steps are…

Well, you are all right.

After sleeping on it, I have capitulated to your calls to rethink everything. And I came up with a better system based on custom fields, and @pmario 's field search, with a tweak of the list item template there.

I updated the file linked above: Interpretation

This looks great to me. It definitely feels cleaner than the design implied in the OP.

One minor nit. I’ve seen you do it before, and I assume this is just how you prefer things, but I find using just an asterisk for a link disconcerting. I actually went to find where that template was, in order to suggest adding a link, only to find that there already was one. A tiny one. Is there a strong reason that the text itself is not the link?

One thing you might want to eventually consider – once you start adding more sources – is to make tiddlers out of them. For instance:

title: The Use and Abuse of the Bible
subtitle: A Brief History of Biblical Interpretation
tags: Source Book [[Bible Scholarship]]
url: https://isbnsearch.org/isbn/9780567090577
author-first: Henry
author-last: Wansbrough
publisher: T&T Clark
pub-date: 2010-04-29

A ViewTemplate here would let you list and link to all the references you make to this book. I find this sort of interlinked navigation very powerful.

Wait a minute sound, let’s say you just saw the one you saw the message.Hi Scott,

I do have source as tiddlers. The fields are just different from the ones you suggested.

I like links as text plus a blue asterisk because I like reading black text yet want the link to be clearly distinct. Black css for links and dotted underline is another route I have sometimes taken.

This is not meant as an edition for others, I am just sharing the results. It is for my use.