Hi! I’m new to Tiddlywiki
I came across this Searchable Dictionary plugin and love it. But the output search seems to sort by its term (name). How can I get it to sort by their meaning (value) instead?
Thank you !!!
Hi! I’m new to Tiddlywiki
I came across this Searchable Dictionary plugin and love it. But the output search seems to sort by its term (name). How can I get it to sort by their meaning (value) instead?
Thank you !!!
Welcome Dezii!
It seems to me (though I’m not a expert user) that the data dictionary concept is deeply structured in this asymmetrical way — the purpose is to treat the term as the “anchor” for handling information, so that an index of the terms helps to retrieve the other half of the pair, but not vice versa.
Browsing this thread, I don’t see any indication that dictionaries can be sorted by the definition (rather than the term being defined).
Of course a quick-and-dirty solution would be for you to insist on running the dictionary “backwards” — put whatever you want to browse/alphabetize in the “term” role (even if it’s usually a longer string), and the other element on the “definition” side…
Again, I’m not an expert. But I suspect that sorting a dictionary by the definitions (rather than the term being defined) is unlikely to be the most elegant way of solving a problem…
Perhaps if you say more about your actual project, and desired workflow process (rather than asking how to get the dictionary plugin to behave differently), we can help you find/develop the interface you need.
-Springer
Hi, Welcome to the community.
I did create a keyvalues plugin, which creates keyvalues
operator. This operator allows you to show the key and the value in an “item” string.
If you place the value before the key and run a sort you should be able to sort by value.
There are several examples, that should show you, how it works.
I do not have the answer yet, It surprises me because I thought I had in the past. I will update this reply if I find something.
I suspect the answer lays in the sort filter run or perhaps move it into a JSONTiddler for which you should be able to sort by the content of each value as if it were just a field.
This seems to do it;
<$list filter="[[$:/palettes/Vanilla]indexes[]] :sort[[$:/palettes/Vanilla]getindex<currentTiddler>]" variable=color>
{{{ [[$:/palettes/Vanilla]getindex<color>else[empty]] }}} <<color>><br>
</$list>
The first filter gets all the indexes with the sort filter run getting the value to sort by.
I like your simple set of regexp examples. I would love to see these extended and documented in tiddlywiki.com. I seem to have a form of dyslexia when I read regular expressions. I need a way to learn them gradually.
The best resource I know about regexps is: https://www.regular-expressions.info/
I did learn it from there.
Yes but at the same time, a couple of dozen expressions should cover 95% of tiddlywiki uses. Lets collect them.
Sorry that I did not make it clear for you guys
Dictionary output itself can sort like whatever, like none would care about sorting the long list of vocabularies right?
But I have changed a little bit so the plugin now become an ICD codes search. I want to find the code when typing in the disease name. So the “term” should now become disease name and “meaning” become the ICD codes. The problem is that the outputs would sort alphabetically by disease name so the ICD codes look very messy
K00.2 - a
K00.0 - b
K01.0 - c
K00 - d
K00.1 - e
K01 - f
The result I want is:
K00 - d
K00.0 - b
K00.1 - e
K00.2 - a
K01 - f
K01.0 - c
I can only thinking of sorting the outputs (ICD codes) that would solve my problem, which mean change the output list filter of the plugin:
filter="""[[$:/data/Dictionary]indexes[]regexp:title[(?i)$(thisSearch)$]]"""
So is there any other approach?
For me this looks like sorting by key. – How does your data/Dictionary look like?
My data tiddler is just rename from Searchable Dictionary, I just reverse the meaning and term position in the output
In the data tiddler, name are the disease name and value are the ICD codes, because I want to look up the ICD codes throught disease names
a: K00.2
b: K00.0
c: K01.0
d: K00
e: K00.1
f: K01
I’ll try your plugin later tonight, look very cool. Now I’m at work. Sorry!
KeyValues plugin sorts the output by value as I wanted. However I also want to display the output in table, I don’t know exactly how to combine this with searchable dictionary (SD) plugin. Here an example of my table:
<table>
<tr>
<th>ICD</th>
<th>Disease</th>
</tr>
<$list filter="""[[$:/data/ICD]indexes[]regexp:title[(?i)$(thisSearch)$]]""">
<tr>
<td> <$transclude tiddler="$:/data/ICD" index=<<currentTiddler>>/> </td>
<td> <<currentTiddler>> </td>
</tr>
</$list>
</table>
The filter used in SD plugin can split the name <<currentTiddler>>
and the value <$transclude tiddler="$:/data/ICD" index=<<currentTiddler>>/>
separately to fit in table easily
And how can I unlink the outputs created by KeyValues? Just only plain text
Thank you!