From cb74efc6054577367fb918565e6ac9ad33f6071e Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 7 May 2021 17:27:15 -0400 Subject: Limit query interface results using search.rowid DESC This vastly increases the speed of the query for any search with a decent number of matches. It can be slightly less accurate since it depends on the insert order of events, but that usually won't be a problem for a query limited to a single network. The litterbox query interface isn't meant to exhaustively list results either. --- litterbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litterbox.c b/litterbox.c index 19bdca6..f219d37 100644 --- a/litterbox.c +++ b/litterbox.c @@ -288,7 +288,7 @@ static void querySearch(struct Message *msg) { WHERE contexts.network = :network AND coalesce(contexts.query = :query, true) AND search MATCH :search - ORDER BY time DESC, event DESC + ORDER BY search.rowid DESC LIMIT :limit ) SELECT * FROM results -- cgit 1.4.1