Ordering of Search Results

107 views
Skip to first unread message

Diego Mesa

unread,
Nov 9, 2017, 10:37:09 AM11/9/17
to TiddlyWiki
Hello all, 

What is the logic behind the ordering of search results? Wouldnt it make sense to order them by Edit/Levenshtein distance:



temp.png

Rob Hoelz

unread,
Nov 9, 2017, 11:06:54 AM11/9/17
to TiddlyWiki
The ordering is alphabetical by title - I'm sure there are plugins available that will add other search tabs with other orderings (eg. I often find myself wanting things ordered by modification date in reverse chronilogical order).  I implemented a full text search plugin that orders results by relevance: https://hoelz.ro/files/fts.html

-Rob

Diego Mesa

unread,
Nov 9, 2017, 11:40:16 AM11/9/17
to TiddlyWiki
Cool plugin Rob! Thanks for this. I think in a personal knowledge base like TW, search should definitely be a first-class part of the TW core. I'd love to see something like fuzzy matching implemented as well:


Thanks for the plugin!

Diego Mesa

unread,
Nov 9, 2017, 11:41:44 AM11/9/17
to TiddlyWiki
By the way, does the index rebuild itself every so often, or do I need to rebuild it?

Diego Mesa

unread,
Nov 9, 2017, 11:42:38 AM11/9/17
to TiddlyWiki
ah - disregard - I see you already answered in the README. Sorry :l

Mark S.

unread,
Nov 9, 2017, 12:00:19 PM11/9/17
to TiddlyWiki
If people want to add their own search engines, that's great. But I would hate to see the default engine become slower than it already is. For that matter, I'd like to turn off the key-by-key mechanism that makes usage on tablets so tedious.

The underlying "sort" comes from executable code built into javascript and so is not too slow. But other mechanisms (like Levenshtein) would have to be run in the javascript interpreter, meaning they would run very slowly as the size of the TW increased.

What makes more sense to me is to use a keywords field with search add-on that checks that field as well. Sometimes the word you're searching for isn't in the text or title. Mat has presented a plugin like that somewhere in the forum.

-- Mark

Rob Hoelz

unread,
Nov 9, 2017, 2:11:47 PM11/9/17
to TiddlyWiki
I'm glad you find it useful! BTW, if you have the time and desire, contributions (such as automatically building the index in the background if it's out of date) are most welcome - I have a whole list of ideas for improvement if you're interested.

Just to be clear - the index does update in the background if it's been built, so that new tiddlers or changes to existing tiddlers are reflected in the index.  It just doesn't save to local storage automatically.

There is definitely room for more types of searches in TiddlyWiki - but I agree with Mark in that a fast and simple search serves as a pretty good default.

-Rob

Mark S.

unread,
Nov 9, 2017, 2:35:55 PM11/9/17
to TiddlyWiki
Could you store the index to a data tiddler so that it could be restored without rebuilding the index the next time the TW is loaded?

-- Mark

Rob Hoelz

unread,
Nov 9, 2017, 4:59:11 PM11/9/17
to TiddlyWiki
I didn't want to contaminate my tiddler store with the index (which can get quite large), so I currently put it in local storage/indexeddb.

-Rob

Mark S.

unread,
Nov 9, 2017, 5:21:03 PM11/9/17
to TiddlyWiki
Oh! So that's why it was slow only the first time?

-- Mark

Rob Hoelz

unread,
Nov 9, 2017, 5:53:53 PM11/9/17
to TiddlyWiki
Yup! The smart thing would be to update the indexeddb store when tiddlers change, but I left that for another day ¯\_(ツ)_/¯
Reply all
Reply to author
Forward
0 new messages