summaryrefslogtreecommitdiffstats
path: root/docs/config.md
diff options
context:
space:
mode:
authorPatrick <pmarschik@users.noreply.github.com>2022-03-18 12:37:27 +0100
committerGitHub <noreply@github.com>2022-03-18 11:37:27 +0000
commitfae118a46ba23da5aed9f4436e16ba7677ecbb84 (patch)
tree5bb01db0358ac1d6fbba74d79b372b06019c0f2e /docs/config.md
parent7cde55a7514c8bce3379847bbcad84bd83cfa42b (diff)
Improve fuzzy search (#279)
* Add SearchMode fzf. Add a new search mode "fzf" that tries to mimic the search syntax of https://github.com/junegunn/fzf#search-syntax This search mode splits the query into terms where each term is matched individually. Terms can have operators like prefix, suffix, exact match only and can be inverted. Additionally, smart-case matching is performed: if a term contains a non-lowercase letter the match will be case-sensitive. * PR feedback. - Use SearchMode::Fuzzy instead of SearchMode::Fzf - update docs - re-order tests so previous fuzzy tests come first, add more tests for each operator * PR comments: remove named arguments, match expression * PR comments: macro -> async func
Diffstat (limited to 'docs/config.md')
-rw-r--r--docs/config.md26
1 files changed, 25 insertions, 1 deletions
diff --git a/docs/config.md b/docs/config.md
index 414146f4f..405e3b57e 100644
--- a/docs/config.md
+++ b/docs/config.md
@@ -97,7 +97,8 @@ key = "~/.atuin-session"
### `search_mode`
Which search mode to use. Atuin supports "prefix", full text and "fuzzy" search
-modes. The prefix search for "query\*", fulltext "\*query\*", and fuzzy "\*q\*u\*e\*r\*y\*"
+modes. The prefix searches for "query\*", fulltext "\*query\*", and fuzzy applies
+the search syntax [described below](#fuzzy-search-syntax).
Defaults to "prefix"
@@ -105,6 +106,29 @@ Defaults to "prefix"
search_mode = "fulltext"
```
+#### `fuzzy` search syntax
+
+The "fuzzy" search syntax is based on the
+[fzf search syntax](https://github.com/junegunn/fzf#search-syntax).
+
+| Token | Match type | Description |
+| --------- | -------------------------- | ------------------------------------ |
+| `sbtrkt` | fuzzy-match | Items that match `sbtrkt` |
+| `'wild` | exact-match (quoted) | Items that include `wild` |
+| `^music` | prefix-exact-match | Items that start with `music` |
+| `.mp3$` | suffix-exact-match | Items that end with `.mp3` |
+| `!fire` | inverse-exact-match | Items that do not include `fire` |
+| `!^music` | inverse-prefix-exact-match | Items that do not start with `music` |
+| `!.mp3$` | inverse-suffix-exact-match | Items that do not end with `.mp3` |
+
+A single bar character term acts as an OR operator. For example, the following
+query matches entries that start with `core` and end with either `go`, `rb`,
+or `py`.
+
+```
+^core go$ | rb$ | py$
+```
+
## Server config
`// TODO`