As announced in my previous blog post, we’ll use SQLite’s Full-Text-Search (FTS) functionality for fast and powerful search functionality directly in the database. To make use of FTS, I had to extend the Dino’s qlite library, which provides a database abstraction for SQLite. The new functionality is now added with qlite’s design in mind (descriptive language for database, tables and columns, SQL-alike query functions with some type-checking at compile time), allowing to enable full-featured FTS for a specified set of columns with just a single statement. With this new FTS functionality it was an easy thing to add a search processing unit to libdino so we can easily perform message searches from the UI. This is also the place where I’ll add support for filter statement pre-processing (see Next steps).

Jump to message

The search UI should include a way to jump to a specific message from the results in order to read previous and following messages. After jumping to a message, the user should be able to infinitely scroll downwards while the application should continuously load and display following messages. This functionality was already implemented for scrolling upwards. I implemented jumping to a message in history by fetching and displaying the respective message and some previous and following messages. I also implemented infinite downwards scrolling. While looking into implementing this, I noticed that all items shown in the conversation view are organized around messages. However, file transfers should be treated the same as messages in many cases. This rarely caused issues when scrolling up to load history and in conversations containing only non-message content. I refactored the code around conversation content and introduced an abstraction layer for content items. The refactoring helped me to implement message fetching in a nicer way.

Search User Interface

At the top of my post is a screenshot how the user interface currently looks like. Doing a mock-up first helped a lot. There are still some displaying issues. After those are solved, I will upload a short video of the message search in use.

Next steps

The user interface still needs polishing. Furthermore, I will implement an auto-completion for the search bar, which will complete user names. If a user name is specified, only messages exchanged with that user will be displayed in the results.