Baloo Natural Query Parser ported to KF5

Published on ven 22 août 2014 in Nepomuk, (Comments)

In 2013, My GSoC project was about implementing a natural (or "human") query parser for what was then Nepomuk. The parser is able to recognize simple Google-like keyword searches in which sentences like "videos accessed last week" can also be used. Sample queries include "KDE Baloo, size < 2M" and "files modified two months ago, Holidays, tagged as Important". An explanation of how the parser can extract the advanced information and of which queries are possible can be found here.

Since then, many things have happened. First, Nepomuk was replaced by Baloo, and the query parser has been ported to Baloo. Then came the KDE Frameworks 5 and Baloo was ported to them (branch frameworks of kde:baloo). The port went well, but the query parser had been disabled in the KF5 version of Baloo.

This week, I have given some love to the QueryParser. First, it was renamed to NaturalQueryParser, because there is another query parser in Baloo (one for simple Xapian queries). Then, I ported it along with the query builder widget to KF5. Finally, I added the possibility to use KFileMetaData to match specific file properties when performing a search. You can now explicitly filter the results of a search by using "width > 300" (the width of an image), "artist contains KDE" (the artist having performed something), etc. The list is independent from Baloo and the query parser does not have to be modified when new properties appear.

Here is a screenshot. It is not yet particularly exciting (except that it is entirely KF5-based), and the auto-completion for property values is still quite basic, but more features are coming and should make this widget way more user friendly:

KF5 Query builder widget

All of this is currently waiting for being reviewed, but can already be tested by checking out the branch naturalqueryparser of Baloo and Baloo Widgets (kde:baloo and kde:baloo-widgets). These branches are based on frameworks and therefore require the Frameworks in order to be compiled.

« Google Summer of Code 2014: QML/Javascript language support for KDevelop 4 and 5   Using Baloo in Dolphin and Apidox love »