Whole words only

Saturday, January 18, 2025

Highlighting search snippets and terms

An important feature of Blossom Search is displaying the context of search terms on the search results page. The context, typically a sentence containing the search terms, is called a snippet. To make it clearer why the context is relevant, Blossom Search highlights the search terms in the snippet.

Currently, we are testing highlighting snippets on retrieved HTML files using a new feature of many browsers called "text fragments". The feature is triggered by adding a command at the end of the URL for a document. The command begins with :~:text= and identifies the text to be highlighted. The resulting effect is that the snippet is highlighted and the page is scrolled, if needed, to bring the snippet into view.

A similar feature is being tested on PDF files. Some PDF readers allow search terms to be appended to a URL causing the terms to be highlighted wherever they appear in the document. Again, this feature is not available in all browsers. We've been using Firefox for our tests; Chromium-based browsers do not currently offer this feature.

This feature has left testing and is now live.