Add query rule to include user thread replies

This commit is contained in:
Zed 2019-12-08 19:48:38 +01:00
parent 2e398c2c87
commit 8a2f4f63a3

View file

@ -55,14 +55,23 @@ proc genQueryParam*(query: Query): string =
if query.kind == users: if query.kind == users:
return query.text return query.text
# improve no-replies result only when searching for less than 7
# otherwise multi-timeline limit goes down to 8 users
let rewriteReplies = "replies" in query.excludes and query.fromUser.len < 7
for i, user in query.fromUser: for i, user in query.fromUser:
if rewriteReplies:
param &= &"(from:{user} AND (to:{user} OR -filter:replies)) "
else:
param &= &"from:{user} " param &= &"from:{user} "
if i < query.fromUser.high: if i < query.fromUser.high:
param &= "OR " param &= "OR "
for f in query.filters: for f in query.filters:
filters.add "filter:" & f filters.add "filter:" & f
for e in query.excludes: for e in query.excludes:
if rewriteReplies and e == "replies": continue
filters.add "-filter:" & e filters.add "-filter:" & e
for i in query.includes: for i in query.includes:
filters.add "include:" & i filters.add "include:" & i