Search and Highlight Plugin

Hi, will take a look

Hi @TiddlyTweeter, have a fix for it. Will upload a new version (0.2.0) shortly.

3 Likes

That would be very interesting and I am sure @BurningTreeC may also be interested.

Best, TT

Try this updated version: https://tiddlywiki-find-in-page-plugin.tiddlyhost.com/ which checks for the multi-column plugin. Let me know if you come across any issues - thanks!

Other search tools just need to populate search criteria into $:/temp/search. Then pressing Ctrl-G will highlight matching items, scrolling them into view.

2 Likes

Good stuff on first look!

I will test some more & report back!

Tx, TT

Looking good now in an MCL …

Also works in combo with MCL’s clever “Reductive Search” (meaning Tiddlers with no match are hidden) … for example …

I think it a great utility. Especially as you can combine it with other search tools!

Grazie, TT

I see you expanded on @bimlas.

He done a lot of great stuff! Maybe 'cause he is Hungarian? :smiley:

TT

Yes, @bimlas 's code does the work :slight_smile:

Looks good! I was not able to get the Reductive search working on mine. Did you do anything with MCL to make it work? Seems like a <$action-setfield is needed somewhere to get $:/state/search-panel/search into $:/temp/search but I’ve had no luck as yet.

I found this plugin a great piece of work! I like the incremental search and highlight!
I only did not require the sidebar segment, as I use ctrl+g so, I just turned it off!

Thank you Aidan (@ahanniga). If you mind please add this plugin to https://links.tiddlywiki.org/ so people can find it.

2 Likes

It maybe you not in MCL actually found the column search? I have been trying to document how it works. This might help?

If you still have issues we need tell @BurningTreeC it is a bug!

FYI, my examples were from the latest FF on Windows 10.

Best, TT

Thanks Mohammed, PR submitted.

2 Likes

I have been using this plugin for maybe two weeks.

It is great but one issue I find is the way it handles search strings of more than one word - for instance if I search for dog cat

The native Tiddlywiki search seems to register two types of hit - I am already using the Context plugin with search ( $:/plugins/danielo515/ContextPlugin )

  1. If the separate words are found in that order in a tiddler then register that as a match - ie exact string match.

  2. If the separate words are found but not in that particular order in a tiddler then list the tiddler but it’s not considered a match but it is a result displayed in the search pull down which lists tiddlers that register hits.

In contrast the search and highlight plugin which otherwise works harmoniously for me seems to consider any occurrence of any of the words a match which is then highlighted and counted in the search and highlight counter.

This means if I enter 4 words then the results I see are effectively the superposition of four separate searches conducted for each of the words separately.

Neither search criteria is wrong or right in my view although I find the highlight plugin criteria less useful because when I search on multiple words I am interested in them appearing in that order sequentially - either an exact string match or something very close ( close might mean flexibility in multiple spaces, punctuation etc ) - I would be happy with exact matches only.

However with both the search and highlight results and the regular search being closely integrated on screen it feels inconsistent when the regular search reports 68 matches and the search and highlight reports 1103 matches - this being a real search I conducted.

My initial take on the most useful behaviour for the search and highlight plugin would be that it would only register and highlight exact string matches or something close as described above.

Some people might find the existing search and highlight behaviour useful?

For instance if they supply a search string of cow cat dog they might be interested in visually identifying paragraphs where more than one of these words occur but not necessarily in that order and not necessarily sequentially.

I don’t expect both search methods to produce the same number of results - the search and highlight only considers tiddlers currently on the story river but I would prefer the search and highlight to produce fewer rather than vastly more results than the regular search when I search for more than one word.

One argument for stricter conditions for a hit in the ‘search and highlight tool’ is if someone wants to search for a phrase like guilding the lilly or passing the buck - the presence of the word the will surely overwhelm the results although this argument might also apply to some extent to the existing base search functionality?

Thoughts anyone?

Right. I do see your issue. But the tool is really only a “text match” … i.e. already visible (rendered in browser) strings are highlighted. TBH it is not really a “search” mechanism, rather only a “screen aware highlighter” … at that it is very good.

You have a point in “HOW do you combine the Highlighter with TW search systems such that they mirror each other?”

I think that an interesting question.

FYI in my own use cases I actually like that I can BOTH search in TW normally AND Highlight DIFFERENTLY.

Just a comment
TT

Thanks TT, yes I think it’s very true that different people will differ in their opinions here, there is no right answer except for each individual in terms of what suits their needs best.

Can anyone assist in relation to this topic?

I would be keen to have/make a macro I can use that I pass a “tiddler name” and a “search string” to, that I can click to open the found tiddler with the search string highlighted. Its fine, even useful, if the search string is found elsewhere on the open tiddlers as well.

Hi @jonnie45,

Try this updated version which works more naturally with multiple words. For example It will find follow in following, but will not split the search if a space is used, such as the follow.

Let me know if any issues, thanks.

3 Likes

Many thanks, I just upgraded and first trial delivered the anticipated result.
:grinning:

I did the same by removing the $:/tags/SideBarSegment tag from $:/plugins/ahanniga/find-in-page/templates/sidebar. Must be a neater way to display number of matches :thinking:

1 Like

Hello @telmiger

It would be nice to use this plugin in combination with Simple Search Plugin (Plugins — Utilities for TiddlyWiki).

Thanks
Stefan

Hi Stefan,
I am sorry but I can’t see the connection at the moment. Simple Search darkens the page so you can focus on search and search results. The find-in-page-plugin can help users of Tiddlydesktop (I am not one of them) to find terms in the story river.
To highlight terms on a darkened page in the background of my search tool seems not reasonable to me and would not offer good usability.
So if you would like to use both solutions in a wiki, you might want to make find-in-page independent from the standard search field (use its own search field). This way it would not conflict with simple search.

All the best,
Thomas