diff options
author | Arun Isaac | 2022-06-27 22:43:52 +0530 |
---|---|---|
committer | Arun Isaac | 2022-06-28 10:05:06 +0530 |
commit | a18bf55baad800b5a0f84680f8a2e9c211d31926 (patch) | |
tree | 7a102b0d8e861bd30951b4635b378a722fb01291 /bin | |
parent | cd9ac47b1aa5e3db313daf1528f60a90004e45da (diff) | |
download | tissue-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-x | bin/tissue | 37 |
1 files changed, 5 insertions, 32 deletions
@@ -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* |