summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorArun Isaac2022-06-27 22:43:52 +0530
committerArun Isaac2022-06-28 10:05:06 +0530
commita18bf55baad800b5a0f84680f8a2e9c211d31926 (patch)
tree7a102b0d8e861bd30951b4635b378a722fb01291 /bin
parentcd9ac47b1aa5e3db313daf1528f60a90004e45da (diff)
downloadtissue-a18bf55baad800b5a0f84680f8a2e9c211d31926.tar.gz
tissue-a18bf55baad800b5a0f84680f8a2e9c211d31926.tar.lz
tissue-a18bf55baad800b5a0f84680f8a2e9c211d31926.zip
bin: Separate out search into (tissue search).
* bin/tissue (tissue-search): Separate out search functionality into search-fold in (tissue search). * tissue/search.scm: New file.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/tissue37
1 files changed, 5 insertions, 32 deletions
diff --git a/bin/tissue b/bin/tissue
index 492bda7..aca0f89 100755
--- a/bin/tissue
+++ b/bin/tissue
@@ -40,6 +40,7 @@ exec guile --no-auto-compile -s "$0" "$@"
(tissue document)
(tissue git)
(tissue issue)
+ (tissue search)
(tissue tissue)
(tissue utils)
(tissue web static))
@@ -82,39 +83,11 @@ Search issues using SEARCH-QUERY.
(args
(call-with-database %xapian-index
(lambda (db)
- (let ((query (parse-query
- ;; 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 (make-stem "en")
- #:prefixes '(("type" . "XT")
- ("title" . "S")
- ("creator" . "A")
- ("last-updater" . "XA")
- ("updater" . "XA")
- ("assigned" . "XI")
- ("keyword" . "K")
- ("tag" . "K")
- ("is" . "XS")))))
- (format #t "total ~a~%"
- (mset-fold (lambda (item count)
- (print (call-with-input-string (document-data (mset-item-document item))
- (compose scm->object read))
- (MSetIterator-mset-get item))
+ (format #t "total ~a~%"
+ (search-fold (lambda (document mset count)
+ (print document mset)
(1+ count))
- 0
- (enquire-mset (enquire db query)
- #:maximum-items (database-document-count db))))))))))
+ 0 db args)))))))
(define tissue-show
(match-lambda*