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 == "" {
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:") {
site := t[5:]
site = "%" + site + "%"

View File

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

View File

@ -143,10 +143,18 @@ section of the manual for details of honk composition.
Find old honks.
It's basic substring match with a few extensions.
The following keywords are supported:
.Bl -tag -width honker
.It site
.Bl -tag -width honker:
.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.
.It honker
.It honker:
Exact match, either AP actor or honker nickname.
.It -
Negate term.