Twitter Email
subspace (/ˈsʌbspɛɪs/)
A Jekyll playground site

The search Syntax

Author: Admin
Title: Search syntax help
Language: en-US
Created: 23:53 on Wednesday, 01. September 2021
Modified: 23:53 on Wednesday, 01. September 2021
Keywords: help, about, search, foo, bar, foobar
Excerpt:

Explains the search syntax for the lunr.js search facility.

Tags: help
Page layout: nonav
Last modified:
23:53 on Wednesday, 01. September 2021 | by Admin

Because this site is built with a static page generator, there is no database to search content. We use lunr.js for implementing a local search feature, utilizing a local index built from content, keywords, titles and tags. Please refer to the official documentation for a detailed description for all of the features. Lunr.js is a quite sophisticated search script and supports a lot of advanced features like fuzziness, searching for multiple terms or limiting the search to specific fields only. The technical implementation details for this site are available here.

Lunr.js is MIT-licensed Open Source Software and is designed to respect your privacy rights. Search queries are never submitted to 3rd parties nor are they stored, archived or logged anywhere. Your privacy matters and Lunr.js does not violate it in any way.

Wildcards

The * (asterisk) operator can be used for wildcard search. So, foo* as a search term will also find foobar. Please note that overusing wild card can degrade search performance and will likely result in too many hits. Particularly performance critical are wildcards at the beginning of a search string. Example: *oo (which would find foo or *moo).

Combining multiple keywords

The search always uses all terms present in the search string. A search string foo bar would search for foo or bar, or both. By default, search terms are combined using a logical OR operation, but there are ways to change that. For example, you can exclude a search term by prefixing it with a minus sign. Searching for foo -bar would only find documents that contain foo but must NOT contain bar. Likewise, you can force a search term by prefixing it with a plus sign. Example: foo +bar will find documents that include both foo and bar.

Fuzziness

You can specify a level of fuzziness with the ~ (tilde) operator, followed by the desired level of fuzziness. Searching for foobar~1 will find slightly misspelled versions of foobar, like fobar. A fuzziness level of 1 or 2 should be sufficient to find most misspelled words. Higher levels may result in too many matches, degrading your search experience (and possibly also the performance) significantly.

Searching for a specific field

Use fieldname:term as syntax. For example, searching for title:foo will only search the titles of the indexed documents. Supported field names are: title, category, keywords, author, excerpt and tags.

Weighting terms

By default, all search terms in a query are of equal importance. However, the ^ (power) operator can be used to boost the weight (importance) of a search term. Searching for foo^10 bar will still find all documents that contain either foo or bar, but those that contain foo will be ranked factor 10 higher in the list of results and therefore appear nearer to the top of the list.