about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-05-07 19:18:03 -0400
committerJune McEnroe <june@causal.agency>2021-05-07 19:29:21 -0400
commite5eb22a7d447c923e500ba6e490ea78168b203a9 (patch)
treec16d5baea2cfa5a8a842b6716cd7cbe21f9774be
parentTry to keep query at end of parameters (diff)
downloadscooper-e5eb22a7d447c923e500ba6e490ea78168b203a9.tar.gz
scooper-e5eb22a7d447c923e500ba6e490ea78168b203a9.zip
Reverse order of search results
I guess I didn't realize I could do this with no performance penalty.
Diffstat (limited to '')
-rw-r--r--search.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/search.c b/search.c
index d2bd4ca..95cac1d 100644
--- a/search.c
+++ b/search.c
@@ -41,6 +41,7 @@ const char *SearchQuery = SQL(
 		AND coalesce(contexts.name = :context, true)
 		AND contexts.query <= NOT :public
 		AND search MATCH :query
+	ORDER BY search.rowid DESC
 	LIMIT :offset, :limit;
 );
 
@@ -90,7 +91,7 @@ enum kcgi_err searchPage(struct kreq *req) {
 			|| khtml_attr(&html, KELEM_TR, KATTR_CLASS, "page", KATTR__MAX)
 			|| khtml_attr(&html, KELEM_TH, KATTR_COLSPAN, "5", KATTR__MAX)
 			|| khtml_attr(&html, KELEM_A, KATTR_HREF, href, KATTR__MAX)
-			|| khtml_puts(&html, "Earlier results")
+			|| khtml_puts(&html, "Later results")
 			|| khtml_closeelem(&html, 3);
 		free(href);
 		if (error) return error;
@@ -138,7 +139,7 @@ enum kcgi_err searchPage(struct kreq *req) {
 			|| khtml_attr(&html, KELEM_TR, KATTR_CLASS, "page", KATTR__MAX)
 			|| khtml_attr(&html, KELEM_TH, KATTR_COLSPAN, "5", KATTR__MAX)
 			|| khtml_attr(&html, KELEM_A, KATTR_HREF, href, KATTR__MAX)
-			|| khtml_puts(&html, "Later results")
+			|| khtml_puts(&html, "Earlier results")
 			|| khtml_closeelem(&html, 3);
 		free(href);
 		if (error) return error;