New search capabilities introduced in version 2.8

Author: admin  |  Category: Development

Text search has always been central to TreeProjects. Back in the days before TreeProjects was conceived, my project management tasks called for a program to store all my documents and find them by keywords. Unfortunately, existing programs did not always have a very good search function, and they struggled with non-English texts, whose alphabets went beyond the standard ANSI latin character set. This made robust, language-independent text search the main requirement for a new personal database that I set out to implement.

However, a personal database should not be only about text search. TreeProjects’ items have attributes like creation date or author name; and it is a good idea to enable users to select information based on those attributes as well. Moreover, it is sometimes desirable to use more complex search rules that consist of multiple search conditions linked by logical operators.

TreeProjects version 2.8 is a major step towards this goal. It now features an “Advanced search” dialog that allows you to specify search queries in a much more flexible way than the regular “Search” dialog provides.

Advanced search dialog with a simple query

The dialog allows to build search queries from search conditions – you can add, edit, delete them, and group them together. Search queries can contain compound conditions that encompass individual search conditions and apply a logical operator – “AND” or “OR”. Moreover, compound conditions can be nested, i.e. a compound condition can have another compound condition as a “child”. The search condition tree itself presents an intuitive way to read and interpret the query.

Advanced search dialog with a nested compound query

For starters, the following search conditions – the building blocks of your search queries – are supported in this version:

  • a text search condition will match all items that contain a certain text; you configure what the desired text is, and where it should be found;
  • an item status condition will match all items that are in a certain status – normal, delete or revision; for example, by adding a single item status condition, you can find all revisions or all deleted items in the database;
  • a branch condition will match all items that reside in a certain branch; you can configure it to match all children of a certain item (with grandchildren, grandgrandchildren and so on), or just the immediate children of the item.

Of course, many more search conditions will be available in the future versions of TreeProjects (released in 2.8.1 and later versions). Moreover, when custom attributes are added to TreeProjects in version 3.0, the advanced search dialog will automatically offer search conditions based on the custom, user-defined attributes.

To create a new query in the Advanced search dialog, you can use the “Advanced search” submenu of the “File” menu – however, you can also edit a query you executed previously. For that, click the “Edit” hyperlink that has been introduced in the search result pane.

The new look of the search results pane

The “Edit” hyperlink will work for all search queries that you initiate, not only advanced ones. This means you can also edit simple text searches that were initiated using the search box.

Under the hood: To enable clean and natural implementation of the “Advanced search” functionality, the underlying database backend engine was considerably overhauled. Previously, a search was internally represented by a simple structure that contained a text query and several parameters. Now, a search is represented as a tree of atomic search condition objects, which are constructed by the user interface and passed to the database backend for validation, translation to SQL and execution. Simple queries are also internally “translated” to the language of search condition trees. As usual, new automated tests of both the database backend and the user interface were designed and implemented to make sure it works and will not be broken in the future, which amounted to almost 50% of the overall development time for the new features. This work was started several month ago and was carried out in a separate development branch, parallel to the 2.7 maintenance releases. For version 2.8, the development branches were merged.

Take care and have fun,


Leave a Reply