From e00d944a93c92d401fa85ddf21b60f852bdd41f9 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 13 Jul 2022 18:17:52 +0530 Subject: search: Sort by date on strictly boolean queries. * issues/sort-by-date.gmi: Close issue. * tissue/search.scm (term-ref, query-terms-every): New functions. (boolean-query?): New public function. (search-fold): Sort by date on strictly boolean queries. * tissue/web/server.scm (handler): Sort by date on strictly boolean queries. --- issues/sort-by-date.gmi | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'issues') diff --git a/issues/sort-by-date.gmi b/issues/sort-by-date.gmi index caa9ae7..8df8cc7 100644 --- a/issues/sort-by-date.gmi +++ b/issues/sort-by-date.gmi @@ -3,3 +3,9 @@ * tags: enhancement The search page with a blank query doubles as a listing of all issues and documents. So, it is nicer if that listing is ordered by creation date. With actual non-blank search queries, it is ok to sort by relevance as we already do. + +## Resolution + +This is now implemented both for the web UI and the CLI. It was a bit more involved than first met the eye. We had to sort by date not just for "blank queries", but for all queries that had only boolean search terms---for example, "tag:enhancement" and "tag:enhancement AND type:issue AND is:open". To do this, we first indexed boolean terms as such. Earlier, we were indexing them as free text. Then, we parsed search queries with some prefixes being marked out as boolean prefixes. Finally, we iterated through the terms in parsed queries and checked if they were all boolean terms. If they were, then we sorted results by date. + +* closed -- cgit v1.2.3