summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2023-01-26 23:56:51 +0000
committerArun Isaac2023-01-26 23:56:51 +0000
commit57b1c5d5b5fb42b065fae24fbd92c2b12670a4b0 (patch)
tree4c6f82063fd229ef2b597714b649bc6c98447c7b
parentbb6c6897de39d0b7316f05a173fce8383f07d399 (diff)
downloadtissue-57b1c5d5b5fb42b065fae24fbd92c2b12670a4b0.tar.gz
tissue-57b1c5d5b5fb42b065fae24fbd92c2b12670a4b0.tar.lz
tissue-57b1c5d5b5fb42b065fae24fbd92c2b12670a4b0.zip
issue: Index names of people as non-boolean terms.
Names of people as non-boolean since it may be required to match them partially. Think searching for "arun" when the full name is "Arun Isaac". * tissue/issue.scm (document-boolean-terms): Remove creator, last updater and assigned terms. (document-term-generator): New method. * tissue/search.scm (%boolean-prefixes): Move creator, lastupdater and assigned to ... (%boolean-prefixes): ... here.
-rw-r--r--tissue/issue.scm15
-rw-r--r--tissue/search.scm8
2 files changed, 14 insertions, 9 deletions
diff --git a/tissue/issue.scm b/tissue/issue.scm
index d5d89bd..c9243ff 100644
--- a/tissue/issue.scm
+++ b/tissue/issue.scm
@@ -62,16 +62,21 @@
(define-method (document-boolean-terms (issue <issue>))
"Return the boolean terms in ISSUE."
- (append (list (string-append "A" (file-document-creator issue))
- (string-append "XA" (file-document-last-updater issue))
- (string-append "XS" (if (issue-open? issue)
+ (append (list (string-append "XS" (if (issue-open? issue)
"open" "closed")))
- (map (cut string-append "XI" <>)
- (issue-assigned issue))
(map (cut string-append "K" <>)
(issue-keywords issue))
(next-method)))
+(define-method (document-term-generator (issue <issue>))
+ "Return a term generator indexing ISSUE."
+ (let ((term-generator (next-method)))
+ (index-text! term-generator (file-document-creator issue) #:prefix "A")
+ (index-text! term-generator (file-document-last-updater issue) #:prefix "XA")
+ (for-each (cut index-text! term-generator <> #:prefix "XI")
+ (issue-assigned issue))
+ term-generator))
+
(define-method (print (issue <issue>) mset port)
"Print ISSUE, an <issue> object, in search results."
(let ((number-of-posts (length (file-document-commits issue))))
diff --git a/tissue/search.scm b/tissue/search.scm
index 8dac645..b9feafc 100644
--- a/tissue/search.scm
+++ b/tissue/search.scm
@@ -49,13 +49,13 @@ mapping field names to prefixes."
query-parser))
(define %prefixes
- '(("title" . "S")))
+ '(("title" . "S")
+ ("creator" . "A")
+ ("lastupdater" . "XA")
+ ("assigned" . "XI")))
(define %boolean-prefixes
'(("type" . "XT")
- ("creator" . "A")
- ("lastupdater" . "XA")
- ("assigned" . "XI")
("keyword" . "K")
("tag" . "K")
("is" . "XS")))