diff options
author | Arun Isaac | 2022-07-13 17:43:03 +0530 |
---|---|---|
committer | Arun Isaac | 2022-07-19 17:37:06 +0530 |
commit | d4cd8ad34b39cea2566e421d9b84ae6d73553db9 (patch) | |
tree | e94dc9fa7377cd33cfef81706d6d8858540ac86f /tissue/document.scm | |
parent | e2fe50c591706a7902048aaef911ce433522a322 (diff) | |
download | tissue-d4cd8ad34b39cea2566e421d9b84ae6d73553db9.tar.gz tissue-d4cd8ad34b39cea2566e421d9b84ae6d73553db9.tar.lz tissue-d4cd8ad34b39cea2566e421d9b84ae6d73553db9.zip |
document: Index boolean terms.
Metadata that will be used in boolean filtering should be indexed as
boolean terms, not as free text. This also results in the happy
coincidence that we no longer need a specialized
document-term-generator generic method for <issue> and <commit>.
* tissue/document.scm (document-boolean-terms): New public generic
function.
(document-term-generator): Use document-boolean-terms.
* tissue/issue.scm (document-boolean-terms): New generic method.
(document-term-generator): Delete generic method.
* tissue/commit.scm (document-boolean-terms): New generic method.
(document-term-generator): Delete generic method.
Diffstat (limited to 'tissue/document.scm')
-rw-r--r-- | tissue/document.scm | 9 |
1 files changed, 8 insertions, 1 deletions
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 |