You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zk/tests/cmd-list-filter-match-fts.tesh

123 lines
4.8 KiB
Plaintext

# Full-text search match strategy.
$ cd full-sample
# Search for a multi-word term.
$ zk list -q --debug-style --match '"green thread"'
><title>Green threads</title> <path>inbox/my59.md</path> (just now)
>
> - …Programming language-provided threads are known as <term>green threads</term>, and languages that use these <term>green threads</term> will execute them in…
>
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
>
> - …so it doesn't support [<term>green threads</term>](inbox/my59).
> * Crates exist to add support for <term>green threads</term> if needed.
> * Instead, Rust relies…
>
# Search for two terms (defaults to AND).
$ zk list -q --debug-style --match 'green channel'
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
>
> - …runtime, so it doesn't support [<term>green</term> threads](inbox/my59).
> * Crates exist to add support for <term>green</term> threads if needed.
> * Instead, Rust…
>
# Search for two term by two --match flags (implicit AND).
$ zk list -q --debug-style --match 'green' --match 'channel'
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
>
> - …runtime, so it doesn't support [<term>green</term> threads](inbox/my59).
> * Crates exist to add support for <term>green</term> threads if needed.
> * Instead, Rust…
>
# Search for two terms with explicit AND.
$ zk list -q --debug-style --match 'green AND channel'
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
>
> - …runtime, so it doesn't support [<term>green</term> threads](inbox/my59).
> * Crates exist to add support for <term>green</term> threads if needed.
> * Instead, Rust…
>
# Search for two terms with OR.
$ zk list -q --debug-style --match 'green OR channel'
><title>Green threads</title> <path>inbox/my59.md</path> (just now)
>
> - …Programming language-provided threads are known as <term>green</term> threads, and languages that use these <term>green</term> threads will execute them in…
>
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
>
> - …runtime, so it doesn't support [<term>green</term> threads](inbox/my59).
> * Crates exist to add support for <term>green</term> threads if needed.
> * Instead, Rust…
>
><title>Channel</title> <path>fwsj.md</path> (just now)
>
> - * <term>Channels</term> are a great approach for safe concurrency.
> * It's an implementation of the [message passing](4oma) pattern.
>
> :programming:
>
><title>Message passing</title> <path>4oma.md</path> (just now)
>
> - * A popular approach for safe concurrency is to use *message passing* instead of shared state.
> * <term>Channels</term> are an example of…
>
><title>Mutex</title> <path>inbox/er4k.md</path> (just now)
>
> - …with a *locking system*.
> * Managing mutexes is tricky, using [<term>channels</term>](../fwsj) is an easier alternative.
> * The main risk is to…
>
# Exclude a term.
$ zk list -q --debug-style --match 'green -channel'
><title>Green threads</title> <path>inbox/my59.md</path> (just now)
>
> - …Programming language-provided threads are known as <term>green</term> threads, and languages that use these <term>green</term> threads will execute them in…
>
# Search in the `title` field.
$ zk list -q --debug-style --match 'title:(green thread)'
><title>Green threads</title> <path>inbox/my59.md</path> (just now)
>
> - > Many operating systems provide an API for creating new threads. This model where a language calls the operating system APIs…
>
# Search with a prefix in `title`.
$ zk list -q --debug-style --match 'title:^do*'
><title>Do not communicate by sharing memory; instead, share memory by communicating</title> <path>ref/7fto.md</path> (just now)
>
> - * Advocates for the use of [message passing](4oma) instead of shared state.
> * A slogan initially coined by Rob Pike ([Effective…
>
><title>Don't speculate</title> <path>pywo.md</path> (just now)
>
> - You have more to loose by doing market timing (jumping in and out of the stocks market). Remember, [the less…
>
# Search with a prefix.
$ zk list -q --debug-style --match 'mut*'
><title>Mutex</title> <path>inbox/er4k.md</path> (just now)
>
> - * Abbreviation of *<term>mutual</term> exclusion*.
> * An approach to manage safely shared state by allowing only a single thread to access a…
>
><title>Data race error</title> <path>3403.md</path> (just now)
>
> - …Rust prevents *data races* by allowing only a single <term>mutable</term> reference of a value per scope.
>
> :programming:
>
><title>Concurrency in Rust</title> <path>g7qa.md</path> (just now)
>
> - …data between threads:
> * [Channel](fwsj) for a safe [message passing](4oma) approach.
> * [<term>Mutex</term>](inbox/er4k) for managing shared state.
>
> :rust:programming:
>