The result list format

Recoll normally uses a full function HTML processor to display the result list and the snippets window. Depending on the version, this may be based on either Qt WebKit or Qt WebEngine. It is then possible to completely customise the result list with full support for CSS and Javascript.

It is also possible to build Recoll to use a simpler Qt QTextBrowser widget to display the HTML, which may be necessary if the ones above are not ported on the system, or to reduce the application size and dependencies. There are limits to what you can do in this case, but it is still possible to decide what data each result will contain, and how it will be displayed.

The result list presentation can be customized by adjusting two elements:

  • The paragraph format

  • HTML code inside the header section. This is also used for the snippets window.

The paragraph format and the header fragment can be edited from the Result list tab of the GUI configuration.

The header fragment is used both for the result list and the snippets window. The snippets list is a table and has a snippets class attribute. Each paragraph in the result list is a table, with class respar, but this can be changed by editing the paragraph format.

There are a few examples on the page about customising the result list on the Recoll Web site.

The paragraph format

This is an arbitrary HTML string which will be transformed by printf-like % substitutions to show the results.

Note

Any literal % character in the input must be quoted as %%. E.g. <table style="width: 100%;"> should be entered as <table style="width: 100%%;">.

The following substitutions will be performed:

%A

Abstract. If %s is not present, this will be either the document abstract attribute if one is present, or the synthetic snippets abstract. If %s is present, this will be the document abstract or empty.

%D

Date.

%I

Icon image name. This is normally determined from the MIME type. The associations are defined inside the mimeconf configuration file. If a thumbnail for the file is found at the standard Freedesktop location, this will be displayed instead.

%K

Keywords.

%L

Precooked Preview, Edit, and possibly Snippets links.

%M

MIME type.

%N

result Number inside the result page.

%P

Parent folder Url. In the case of an embedded document, this is the parent folder for the top level container file.

%R

Relevance percentage.

%S

Size information.

%s

Synthetic "snippets" abstract (selected text around search terms found in the document.

%T

Title if this is set, else Filename.

%t

Title or empty.

%(filename)

File name.

%U

Url

In addition to the predefined values above, all strings like %(fieldname) will be replaced by the value of the field named fieldname for this document. Only stored fields can be accessed in this way, the value of indexed but not stored fields is not known at this point in the search process (see field configuration). There are currently very few fields stored by default, apart from the values above (only author and filename), so this feature will need some custom local configuration to be useful. An example candidate would be the recipient field which is generated by the message input handlers.

The format of the Preview, Edit, and Snippets links is <a href="P%N">, <a href="E%N"> and <a href="A%N"> where docnum (%N) expands to the document number inside the result page).

A link target defined as "F%N" will open the document corresponding to the %P parent folder expansion, usually creating a file manager window on the folder where the container file resides. E.g.:

<a href="F%N">%P</a>

A link target defined as R%N|scriptname will run the corresponding script on the result file (if the document is embedded, the script will be started on the top-level parent). See the section about defining scripts. Note that scriptname value should be the value of the Name field of the desktop file, and not the desktop file name.

The default value for the paragraph format string is:

            "<table class=\"respar\">\n"
            "<tr>\n"
            "<td><a href='%U'><img src='%I' width='64'></a></td>\n"
            "<td>%L &nbsp;<i>%S</i> &nbsp;&nbsp;<b>%T</b><br>\n"
            "<span style='white-space:nowrap'><i>%M</i>&nbsp;%D</span>&nbsp;&nbsp;&nbsp; <i>%U</i>&nbsp;%i<br>\n"
            "%s %A %K</td>\n"
            "</tr></table>\n"
            

You may, for example, try the following for a more web-like experience:

            <u><b><a href="P%N">%T</a></b></u><br>
            %A<font color=#008000>%U - %S</font> - %L
            

Note that the P%N link in the above paragraph makes the title a preview link. Or the clean looking:

            <img src="%I" align="left">%L <font color="#900000">%R</font>
            &nbsp;&nbsp;<b>%T&</b><br>%S&nbsp;
            <font color="#808080"><i>%U</i></font>
            <table bgcolor="#e0e0e0">
            <tr><td><div>%A</div></td></tr>
            </table>%K
            

These samples, and some others are on the web site, with pictures to show how they look.

It is also possible to define the value of the snippet separator inside the abstract section.