Skip to content

Commit b669140

Browse files
committed
feat!: Align the web search syntax and semantics on gnaw.el
Breaking-Users: A bare word now searches subjects only (it used to also match author, owner, date and topic). "priority:2" now means exactly 2, not "2 or more": you can write "p:2,3" for that. "date:2026-01-01" now means that very day, not "since that day". You can write "date:2026-01-01.." for that. A key without a value (e.g. "from:") now empties the list.
1 parent 1d6de04 commit b669140

8 files changed

Lines changed: 771 additions & 312 deletions

File tree

bb.edn

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
test-config {:doc "Validate config.edn (pass path as arg, default: ./config.edn)"
4040
:task (apply shell "bb scripts/validate-config.clj" *command-line-args*)}
4141

42+
test-search {:doc "Run the search-engine conformance cases (needs node)"
43+
:task (shell "node" "test/bone-search-conformance.js")}
44+
4245
maintenance {:doc "Purge orphan emails: bb maintenance [--delete] [--verbose] [-n source] [--retention 90d] [--failures]"
4346
:task (apply shell "bb scripts/bone-maintenance.clj" *command-line-args*)}
4447

docs/bone-manual.org

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -736,32 +736,63 @@ export time.
736736
** Browsing BONE reports online
737737

738738
The exported HTML site lets you browse a source's reports and filter
739-
them through a minimal search syntax:
740-
741-
| Long form | Short | Explanation |
742-
|---------------------------------+-----------+-------------------------------------------------------|
743-
| from:me@example.org | f: | Reports from me@example.org |
744-
| acked:me@example.org | a: | Reports acked by me@example.org |
745-
| owned:me@example.org | o: | Reports owned by me@example.org |
746-
| closed:me@example.org | c: | Reports closed by me@example.org |
747-
| urgent:me@example.org | u: | Reports marked urgent by me@example.org |
748-
| important:me@example.org | i: | Reports marked important by me@example.org |
749-
| subject:match | s: | Reports matching subject |
750-
| topic:match | t: | Reports matching topic |
751-
| priority:[0-4] | p: | Reports matching priority level 0 to 4 |
752-
| mid:<messageid> | m: | Report with message-id <messageid> |
753-
| date:3d.. | d: | Reports from the last 3 days |
754-
| date:2023-01-01..2023-12-31 | d: | Reports from 2023-01-01 to 2023-12-31 |
755-
| deadline:2026-09-01 | D: | Reports with deadline on 2026-09-01 |
756-
| deadline:2026-01-01..2026-06-30 | D: | Reports with deadline in that range |
757-
| deadline:2m | D: | Reports due between now and 2 months from now |
758-
| expired:10d | e: | Reports expired between now and 10 days from now |
759-
| expired:2026-01-01..2026-03-31 | e: | Reports expired in that date range |
760-
| match1 \vert match2 | | Reports matching "match1" or "match2" |
761-
| from:* acked:* … | f:* a:* … | Wildcard for from/acked/owned/closed/urgent/important |
762-
763-
Durations are =Nd= (days), =Nw= (weeks), =Nm= (months). =date:= looks backward
764-
from today; =deadline:= and =expired:= look forward.
739+
them with =key:value= tokens. A space between tokens is AND, =|=
740+
separates OR clauses, and a comma inside a value is OR:
741+
=type:bug s:crash | topic:latex= keeps the bug reports whose subject
742+
matches "crash", plus every report with a latex topic. A bare word
743+
(or an unknown key) searches the subject. A leading =-= negates the
744+
whole token, comma alternatives included: =-type:patch=, =-acked:*=.
745+
746+
Double quotes keep a value (or a bare token) together and literal:
747+
="preamble shuffling"= and =subject:"preamble shuffling"= match that
748+
phrase, spaces, commas, =|= and slashes losing their meaning inside
749+
the quotes.
750+
751+
An empty value matches nothing, whatever the key.
752+
753+
A value in slashes is matched as a case-insensitive regexp on the
754+
text fields (=from:=, =subject:= and bare words, =topic:=, =source:=, =mid:=,
755+
and the person fields =acked:= =owned:= =closed:=): =subject:/v[0-9]+/=.
756+
The regexp is always the whole value -- a =,= loses its meaning
757+
inside, and =|= being a clause separator, regexp alternation cannot
758+
appear either: to OR two regexps, use two clauses (=s:/a/ | s:/b/=).
759+
760+
| Long form | Short | Matches |
761+
|---------------------------------+----------+--------------------------------------------|
762+
| =from:bzg= | =f:= | from address or name |
763+
| =subject:crash,latex= | =s:= | subject (a bare word matches subject) |
764+
| =similar:a+b+c= | | subjects sharing 3 of the =+=-joined words |
765+
| =topic:agenda= | =t:= =T:= | any of the report's topics |
766+
| =source:emacs= | =S:= | source name (one char: exact) |
767+
| =type:patch= | | report type |
768+
| =priority:2= | =p:= | exact priority (0-3) |
769+
| =mid:<...>= | =m:= | message-id |
770+
| =acked:bzg= =owned:*= =closed:*= | =a: o: c:= | by person (or =*= for any) |
771+
| =urgent:*= =important:false= | =u: i:= | marks (set or not) |
772+
| =flags:AO= | =F:= | Flags letters, all required (A O C R E S) |
773+
| =att:~+= | =A:= | Att glyphs, all required (. ~ + x @ #) |
774+
| =date:3d= =date:A..B= | =d:= | created (durations =Nd/Nw/Nm=, ranges) |
775+
| =deadline:2m= | =D:= | due within / on (forward) |
776+
| =expired:10d= | =e:= | expiring within (forward) |
777+
| =closed:true= | =c:true= | include closed reports (transient) |
778+
779+
Durations: =Nd= (days), =Nw= (weeks), =Nm= (months). A lone date is
780+
that exact day; open range ends stay open (=date:2026-01-01..= has no
781+
upper bound). =date:= looks backward from today; =deadline:= and
782+
=expired:= look forward.
783+
784+
=type:=, =flags:= and =att:= are closed sets compared literally: no =*=,
785+
quotes or regexps there, and =type:*= matches nothing. =priority:= is
786+
exact -- =p:2,3= for "at least 2".
787+
788+
=closed:true= bypasses the Open filter without touching the button:
789+
clearing the search restores it. Any =closed:= or =flags:= token naming
790+
a close reason (C R E S) also loads and includes the closed reports,
791+
so those queries answer honestly.
792+
793+
The same syntax drives the search of [[https://codeberg.org/bzg/gnaw.el][gnaw.el]], whose regexps use the
794+
Emacs dialect and whose =source:= key also matches the one-letter
795+
source identifiers of its local configuration.
765796

766797
** The =gnaw= CLI tool and Emacs clients
767798

0 commit comments

Comments
 (0)