How a query is processed
The purpose of a query is to match with a shortcut. And shortcuts are organized by Namespaces: Every shortcut belongs exactly to one namespace.
When calling Trovu without query parameters, 3 default namespaces will be set based on the browser's language settings. For instance, if the browser's language is
de-DE, we will use these namespaces and their shortcut files:
Processing a query
Now, let's look at the processing of a query:
- A query comes in, e.g.
- The current namespace setting is
- The fetch() call checks also if the files are already in the browser cache, and only requests them from remote if they are not cached yet.
- To reload the shortcuts, use the
reloadcommand (see below).
- Based on the query and the namespace settings, the loaded shortcuts are searched whether they match a query with the keyword
gand one argument, i.e. if they contain a shortcut keyed with
- We find 2 matches:
- From the found matches, the results are evaluated in namespace order.
- Since namespace
.dehas higher priority than
o, its URL is used for further processing
<$language>placeholder is being replaced with the variable
<query>placeholder is being replaced with the query argument
- A redirect to the URL is made.
Since shortcuts are cached in the browser cache, you may want to reload them once they got updated. Do so by
- either prefixing a query:
- or only calling