This is all looking incredible. We are now tapping into the power of full-text search by allowing it to rank our documents based on search terms and a variety of other factors. We can even provide a custom set of weights so that a search term appearing in the title of a reminder scores a little more than if it appears in the notes or tags. And we are doing it all in a type-safe and schema-safe manner.
And it may be hard to believe, but there is even more power lurking in the shadows of the FTS5 module in SQLite. Let’s start with search term highlighting. The FTS5 module comes with a function called highlight
that allows you to highlight the search terms inside the fields you are searching. This makes it possible to create very friendly search UI’s where not only are the search results being displayed to the user, but the actual bits of text that were matched from the query are highlighted in the view.
Sounds complex, but FTS5 makes this a breeze. Let’s check it out.