Inverse Index:How do I find the indexes whose value contain a specific word?

…do I have to use a Map Filter Run Prefix to achieve this.

E.g. All indexes of a tiddler that have a word in the searchfield in them.

The :map Filter Run Prefx is used to change the values of all input items without removing any items. If there are N items input, there will be N items output, even if some of them are blank or have duplicate values.

In contrast, the :filter Filter Run Prefix is used to retain only those input items that satisfy a given condition. It does not modify the values of the input items.

In both cases, within the Filter Run, the current input item can be referred to using <currentTiddler>.

Thus, for your purposes, use something like this:

<$let tid="SomeTiddler" find="sometext">
{{{ [<tid>indexes[]] :filter[<tid>getindex<currentTiddler>search:title<find>] }}}

enjoy,
-e

2 Likes

My keyvalues-plugin may be an option.

3 Likes

Great, this is a funtionality could/should be added to the core.

Hi Eric,
Thank you…and how do I do to sort the result alphabetically according to the values?

Add a :sort filter run, like this:

<$let tid="SomeTiddler" find="sometext">
{{{ [<tid>indexes[]]
    :filter[<tid>getindex<currentTiddler>search:title<find>]
    :sort[<tid>getindex<currentTiddler>] }}}

enjoy,
-e

1 Like

It was rejected, so I made a plugin. But that was before we had Named Filter Run Prefix

Since there is the demand to “store” some intermediate “results” into variables other than currentTiddler, it may be possible store currentTiddler = key and value into intermediate variables.

So filters may be able to look like this:

[[test]getkeyvalues[]] :map[<key>addsuffix[ : ]addsuffix<value>]

This would eliminate all the complex parameters that I had to define for my keyvalues-plugin.

I’m not sure if something as follows would be possible to implement. But it should be – (just brainstorming)

[[test]getkeyvalues[]] :filter[<key>prefix[test-]] :map[<key>addsuffix[ : ]addsuffix<value>]

I’ll add this to my issues-list for the plugin, so I do not forget about it.

1 Like