mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-12 02:56:29 +00:00
Minor multi-user timeline optimization
This commit is contained in:
parent
326776fde7
commit
feb939d918
1 changed files with 5 additions and 6 deletions
|
@ -48,7 +48,7 @@ proc getReplyQuery*(name: string): Query =
|
||||||
fromUser: @[name]
|
fromUser: @[name]
|
||||||
)
|
)
|
||||||
|
|
||||||
proc genQueryParam*(query: Query): string =
|
proc genQueryParam*(query: Query; rewriteReplies=true): string =
|
||||||
var filters: seq[string]
|
var filters: seq[string]
|
||||||
var param: string
|
var param: string
|
||||||
let userSearch = query.fromUser.len > 0
|
let userSearch = query.fromUser.len > 0
|
||||||
|
@ -56,13 +56,9 @@ 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:
|
if rewriteReplies:
|
||||||
param &= &"(from:{user} AND (to:{user} OR -filter:replies)) "
|
param &= &"(from:{user}(to:{user} OR -filter:replies)) "
|
||||||
else:
|
else:
|
||||||
param &= &"from:{user} "
|
param &= &"from:{user} "
|
||||||
|
|
||||||
|
@ -87,6 +83,9 @@ proc genQueryParam*(query: Query): string =
|
||||||
if query.text.len > 0:
|
if query.text.len > 0:
|
||||||
result &= " " & query.text
|
result &= " " & query.text
|
||||||
|
|
||||||
|
if userSearch and rewriteReplies and result.len >= 500:
|
||||||
|
return genQueryParam(query, rewriteReplies=false)
|
||||||
|
|
||||||
proc genQueryUrl*(query: Query): string =
|
proc genQueryUrl*(query: Query): string =
|
||||||
if query.kind notin {tweets, users}: return
|
if query.kind notin {tweets, users}: return
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue