Highlighting of Search Results in Browser

With the upcoming browse window updates coming in 2.1.41 (of which I early await the release of), I wonder if it might be possible for highlighting of search results to be added as a feature?

Currently, typing a word/phrase into the search field finds associated notes but it can be difficult finding that specific part of a card. This can become especially annoying when trying to adjust multiple cards at once.

Majority of applications have this functionality already and I feel that it would be a good QoL feature that many could benefit from.

1 Like

There is an add-on that does this: Highlight Search Results in the Browser - AnkiWeb

It is so basic in web browsers and so useful that I think it should be implemented in Anki natively.

Yes, this is an add-on I used extensively with previous Anki versions. With the newest 2.1.41 browse window changes however, the add-on no longer works. I believe Glutanimate is quite busy with personal things at the moment so it’s unlikely that the add-on will be updated to support 2.1.41 any time soon.

Nevertheless, I believe the feature should be added natively regardless of 3rd party support since it is incredibly handy and a basic function of many other applications.

As powerful as Anki’s search functions are, the lack of highlighting search terms makes it very difficult for me to use it as extensively and effectively as I’d like.

1 Like

Unlike a web browser’s search tool which can usually only search for a plain text string, Anki’s search has its own syntax to allow for searching for all sorts of card and note data that needs to be parsed. So how would you decide which word to highlight for a given search expression?

Latest beta with support for Anki 2.1.41 is out. You can download it here: Release Version 1.0.0-beta.1 · glutanimate/highlight-search-results · GitHub

If no issues are found, AnkiWeb release will follow soon.

3 Likes

I stand corrected, thank you very much for your work!
It works beautifully!

I’m not too sure. Perhaps something along these lines?:

  • Anything with a single piece of text (e.g. “the”) will be highlighted across all cards where found.

  • Anything with multiple pieces of text (e.g. “what” AND “is” AND “the”) highlights the text in different colours if found in isolation on different parts of a card, or as a single colour if found as a single string.

I understand that there are more complex searches that can be performed, but this is sort of what I was thinking if it were to be implemented natively.

Glutanimate’s add-on, whilst being as great as it is, will only highlight a single word in the search bar.
For searches like “the”, this works great. For searches like “what” AND “is” AND “the”, only the “the” portion of the search will be highlighted in cards.

@rworldd glad to hear that it works!

The fact that only one term is being highlighted is unfortunate for sure. It used to be that the add-on was able to highlight an arbitrary number of terms on, but that’s sadly no longer supported by Anki’s widget toolkit.

But this is definitely the most requested feature and something I’d like to look into as soon as time permits.


Re: testing

To anyone else reading this, if you’re on an older version of Anki, please don’t hesitate to give the beta a try, too. As this is a major rewrite whose release had been pending for a while now, I would highly appreciate any help in ruling out regressions on older versions of Anki.