add some more search capabilities

This commit is contained in:
Ted Unangst 2023-07-03 00:45:35 -04:00
parent 6b46a2a597
commit 8a14e67b32
3 changed files with 33 additions and 3 deletions

View File

@ -303,6 +303,26 @@ func gethonksbysearch(userid int64, q string, wanted int64) []*Honk {
if t == "" { if t == "" {
continue continue
} }
if t == "@me" {
queries = append(queries, "whofore = 1")
continue
}
if t == "@self" {
queries = append(queries, "(whofore = 2 or whofore = 3)")
continue
}
if strings.HasPrefix(t, "before:") {
before := t[7:]
queries = append(queries, "dt < ?")
params = append(params, before)
continue
}
if strings.HasPrefix(t, "after:") {
after := t[6:]
queries = append(queries, "dt > ?")
params = append(params, after)
continue
}
if strings.HasPrefix(t, "site:") { if strings.HasPrefix(t, "site:") {
site := t[5:] site := t[5:]
site = "%" + site + "%" site = "%" + site + "%"

View File

@ -2,6 +2,8 @@ changelog
=== next === next
+ Improved search.
+ Tuned up superdeliverator. + Tuned up superdeliverator.
+ Import from instagram. + Import from instagram.

View File

@ -143,10 +143,18 @@ section of the manual for details of honk composition.
Find old honks. Find old honks.
It's basic substring match with a few extensions. It's basic substring match with a few extensions.
The following keywords are supported: The following keywords are supported:
.Bl -tag -width honker .Bl -tag -width honker:
.It site .It @me
Honks mentioning the user.
.It @self
Honks by the user.
.It before:
Honks posted before YYYY-MM-DD.
.It after:
As above.
.It site:
Substring match on the post domain name. Substring match on the post domain name.
.It honker .It honker:
Exact match, either AP actor or honker nickname. Exact match, either AP actor or honker nickname.
.It - .It -
Negate term. Negate term.