diff options
-rw-r--r-- | tissue/commit.scm | 11 | ||||
-rw-r--r-- | tissue/document.scm | 9 | ||||
-rw-r--r-- | tissue/issue.scm | 24 |
3 files changed, 24 insertions, 20 deletions
diff --git a/tissue/commit.scm b/tissue/commit.scm index 30d07b7..10dc436 100644 --- a/tissue/commit.scm +++ b/tissue/commit.scm @@ -42,16 +42,15 @@ "Return the ID term for DOCUMENT." (string-append "Qcommit." (commit-hash commit))) +(define-method (document-boolean-terms (commit <commit>)) + "Return the boolean terms in COMMIT." + (list (string-append "Qcommit." (commit-hash commit)) + (string-append "A" (doc:commit-author commit)))) + (define-method (document-recency-date (commit <commit>)) "Return a date representing the recency of DOCUMENT" (doc:commit-author-date commit)) -(define-method (document-term-generator (commit <commit>)) - "Return a term generator indexing COMMIT." - (let ((term-generator (next-method))) - (index-person! term-generator (doc:commit-author commit) "A") - term-generator)) - (define-method (document-snippet-source-text (commit <commit>)) "Return the source text for COMMIT from which to extract a search result snippet." diff --git a/tissue/document.scm b/tissue/document.scm index ecdabc3..48d82cc 100644 --- a/tissue/document.scm +++ b/tissue/document.scm @@ -36,6 +36,7 @@ document-web-uri document-type document-id-term + document-boolean-terms document-text document-recency-date document-term-generator @@ -142,6 +143,10 @@ that operates on a copy of OBJECT. It does not mutate OBJECT." (string-trim-both (symbol->string (class-name (class-of document))) (char-set #\< #\>))) +(define-method (document-boolean-terms (document <document>)) + "Return the boolean terms in DOCUMENT." + (list)) + (define-method (document-term-generator (document <document>)) "Return a term generator for DOCUMENT. The returned term generator has indexed the type and text of the document. If further free text is to @@ -153,7 +158,9 @@ and further text, increase-termpos! must be called before indexing." #:document (make-document #:data (call-with-output-string (cut write (object->scm document) <>)) - #:terms `((,(document-id-term document) . 0)) + #:terms (map (cut cons <> 0) + (cons (document-id-term document) + (document-boolean-terms document))) ;; This serialization of the recency date gets ;; the timezone ordering wrong. TODO: Replace it ;; with sortable-serialise once it is working in diff --git a/tissue/issue.scm b/tissue/issue.scm index 3fb21cc..23625fa 100644 --- a/tissue/issue.scm +++ b/tissue/issue.scm @@ -58,19 +58,17 @@ (tasks #:accessor issue-tasks #:init-keyword #:tasks) (completed-tasks #:accessor issue-completed-tasks #:init-keyword #:completed-tasks)) -(define-method (document-term-generator (issue <issue>)) - "Return a term generator indexing ISSUE." - (let ((term-generator (next-method))) - (index-person! term-generator (file-document-creator issue) "A") - (index-person! term-generator (file-document-last-updater issue) "XA") - (for-each (cut index-person! term-generator <> "XI") - (issue-assigned issue)) - (for-each (cut index-text! term-generator <> #:prefix "K") - (issue-keywords issue)) - (index-text! term-generator - (if (issue-open? issue) "open" "closed") - #:prefix "XS") - term-generator)) +(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) + "open" "closed"))) + (map (cut string-append "XI" <>) + (issue-assigned issue)) + (map (cut string-append "K" <>) + (issue-keywords issue)) + (next-method))) (define-method (print (issue <issue>) mset port) "Print ISSUE, an <issue> object, in search results." |