5. Search query model¶
5.1. Definitions¶
- program query selector
- The empty query selector which only selects command snippets that call the program name given as query selector value.
For example,
:dd
will restrict the selection to snippets containing reference to thedd
program. - query literal
- The query answer will try to match any one of those provided literals.
Such a literal has the shape of any word that is not composed of special characters with the exception of
-
and_
. - query selector
It constrains the scope of the current query. Such a selector has the form of two words separated with the
:
character. The first, optional word is the operator (what is selected) and the second word is the value. When the operator is omitted, the program selector is processed.[OPERATOR]:VALUE
5.2. Syntax¶
Note
The program internal string representations are in utf-8 and I/O operation will be transcoded to the environement encoding. See Character encoding.
Note
This is a normalized syntax. If the user inputs forbidden characters, they shall be stripped out.
Note
See the Shared definitions for ABNF grammars section for the depending token definitions.
SELECTOR-CHAR = ALPHA / DIGIT / HYPHEN / UNDERSCORE
; ASCII alphanum character or hyphen or underscore
LITERAL-CHAR = UTF8-2 / UTF8-3 / UTF8-4 / ALPHA / DIGIT / HYPHEN / UNDERSCORE
; UTF-8 alphanum character or hyphen or underscore
LITERAL = 1*(LITERAL-CHAR)
; A literal is a sequence of non-special, non-whitespace characters
; or hyphen or underscore
SELECTOR-OPERATOR = 1*(SELECTOR-CHAR)
SELECTOR-VALUE = 1*(SELECTOR-CHAR)
SELECTOR = *(SELECTOR-OPERATOR) COLON SELECTOR-VALUE
; A selector is a sequence of non-special, non-whitespace
; ASCII characters or hyphen or underscore, preceded with a colon
QUERY-WORD = SELECTOR / LITERAL
QUERY = QUERY-WORD / (QUERY-WORD WSP-SEQUENCE QUERY)
5.3. List of selectors¶
to be written
5.4. Search sort requirements¶
Result By Relevance
Results should be sorted by relevance.
Relevance Composition
Relevance should be a composition of
- string matching in snippet description
- snippet popularity
- snippet reputation