summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorArun Isaac2022-06-26 01:32:13 +0530
committerArun Isaac2022-06-27 00:19:36 +0530
commit650642b4cf43b4390c1332c930124eda88ea4109 (patch)
tree476560b80c22281ddf1b7e01d96b7f7a7c5bcfb6 /bin
parenta27e3cb2975421b0cb23a4dbe3daa2f7507df055 (diff)
downloadtissue-650642b4cf43b4390c1332c930124eda88ea4109.tar.gz
tissue-650642b4cf43b4390c1332c930124eda88ea4109.tar.lz
tissue-650642b4cf43b4390c1332c930124eda88ea4109.zip
bin: Assume is:open in queries.
* bin/tissue (tissue-search): Assume is:open in queries.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/tissue20
1 files changed, 13 insertions, 7 deletions
diff --git a/bin/tissue b/bin/tissue
index 8c13114..95c1f9a 100755
--- a/bin/tissue
+++ b/bin/tissue
@@ -176,14 +176,20 @@ Search issues using SEARCH-QUERY.
(call-with-database %xapian-index
(lambda (db)
(let* ((stemmer (make-stem "en"))
- (query-string (string-join args))
(query (parse-query
- ;; If issue state is not mentioned in query,
- ;; assume is:open.
- (cond
- ((string-null? query-string) "is:open")
- ((string-contains-ci query-string "is:") query-string)
- (else (format #f "is:open AND (~a)" query-string)))
+ ;; When query does not mention type or state,
+ ;; assume is:open. Assuming is:open is
+ ;; implicitly assuming type:issue since only
+ ;; issues can have is:open.
+ (if (every string-null? args)
+ "is:open"
+ (string-join (if (any (lambda (query-string)
+ (or (string-contains-ci query-string "type:")
+ (string-contains-ci query-string "is:")))
+ args)
+ args
+ (cons "is:open" args))
+ " AND "))
#:stemmer stemmer
#:prefixes '(("type" . "XT")
("title" . "S")