hoelzro / tw-full-text-search

Full text search plugin for TiddlyWiki powered by lunr.js
https://hoelz.ro/files/fts.html
Other
25 stars 4 forks source link

Display scoring #16

Open hoelzro opened 5 years ago

hoelzro commented 5 years ago

Brought up by @diego898 in #5

The search results are ordered by a score; it might be nice to show the user a visual representation of this score.

As far as the appearance goes, I'm thinking a bar alongside the title in the results - the wider the bar, the more relevant the result was to the query.

As far as implementation goes, I'm thinking we would need to stash the scores in a data tiddler indexed by the tiddler names. I think that ftsearch itself would need to do this, which raises the question of how this would work if there are multiple ftsearch filters being displayed...

hoelzro commented 5 years ago

For the bar, I was thinking of using Tobias' sparkl plugin: http://tobibeer.github.io/tw5-plugins/#sparkl

hoelzro commented 5 years ago

As far as worrying about the data tiddler and multiple active ftsearch filters - maybe I could reference a variable settable via <$set></$set>? This should work, but feels a little hacky/side effecty, which I feel filters try to avoid - maybe I should check with the Google group and see what how others feel about it.

This might not work super well if you're chaining ftsearch filters - chances are you wouldn't do that (you would just compose a single query, plus the final resulting score would kind of lose meaning), but nothing's stopping you - is that a problem?

hoelzro commented 5 years ago

I tried using a filter suffix (eg. ftsearch:test[query]) with a qualified tiddler as the suffix, inserted via a macro - this didn't work because the tiddler name interfered with the filter parser.

hoelzro commented 5 years ago

Reopening because the feature is way too slow for general use, and I don't want to block the next major release