Twitter Email
silvercircle No addendum
A Jekyll test site with no particular purpose.

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.

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


This site uses lunr.js for implementing a local search feature. 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 details are available here.

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 always combined using a logical OR operation, but this can be changed. For example, you can exclude a search term by prepending it with a minus sign. Searching for foo -bar would only find documents that include foo but NOT bar. Likewise, you can force a search term by prepending it with a plus sign. Example: foo +bar will only 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 would find slightly misspelled versions of foobar, like fobar. A fuzziness level of 1 or 2 should be sufficient to find misspelled words. Higher levels may result in too many matches, degrading your search experience 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.

Weighting terms

By default, all search terms in a query are of equal importance. Using the ^ (power) operator will 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.