summaryrefslogtreecommitdiff
path: root/tissue/commit.scm
diff options
context:
space:
mode:
authorArun Isaac2023-01-29 16:23:45 +0000
committerArun Isaac2023-01-29 16:46:38 +0000
commit8516e5d0f5b64c681d31efa2944bb9a9de32dbbc (patch)
treee8def557954f95796cb419ada71a7ed5346533c2 /tissue/commit.scm
parentd5adbcf983bb2d83fd46041ad3226dd8912266a6 (diff)
downloadtissue-8516e5d0f5b64c681d31efa2944bb9a9de32dbbc.tar.gz
tissue-8516e5d0f5b64c681d31efa2944bb9a9de32dbbc.tar.lz
tissue-8516e5d0f5b64c681d31efa2944bb9a9de32dbbc.zip
document: Inter snippet source text into the xapian index.
We store snippet source text in a slot of the <document> class thus interring into the xapian index. This allows us to render search snippets using only the xapian index without referring back to the git repository. * tissue/document.scm (<document>)[snippet-source-text]: New slot. * tissue/document.scm (document-snippet-source-text): Delete method. (document-html-snippet): Remove blank lines from snippet source text before generating a snippet. * tissue/commit.scm (document-snippet-source-text): Delete method. (repository-commits): Initialize snippet-source-text. * tissue/skribilo.scm (fragment-text): New function. (document-fragment): Initialize snippet-source-text. (document-text): Use fragment-text. (document-snippet-source-text): Delete method. * tissue/file-document.scm (file-text): New function. (document-text): Use file-text. (read-gemtext-document): Initialize snippet-source-text. * tissue/issue.scm (read-gemtext-issue): Initialize snippet-source-text. * issues/skribilo-fragment-snippets-need-code-from-repo.gmi: Close issue.
Diffstat (limited to 'tissue/commit.scm')
-rw-r--r--tissue/commit.scm18
1 files changed, 8 insertions, 10 deletions
diff --git a/tissue/commit.scm b/tissue/commit.scm
index c151d3a..b910695 100644
--- a/tissue/commit.scm
+++ b/tissue/commit.scm
@@ -51,15 +51,6 @@
"Return a date representing the recency of COMMIT."
(doc:commit-author-date commit))
-(define-method (document-snippet-source-text (commit <commit>))
- "Return the source text for COMMIT from which to extract a search
-result snippet."
- ;; The snippet source text excludes the first paragraph (i.e., the
- ;; summary line) of the commit. Hence, we use commit-body.
- (commit-body
- (commit-lookup (current-git-repository)
- (string->oid (commit-hash commit)))))
-
(define-method (document-text (commit <commit>))
"Return the full text of COMMIT."
(commit-message
@@ -101,7 +92,14 @@ REPOSITORY."
#:hash (oid->string (commit-id commit))
#:author (resolve-alias (signature-name (commit-author commit))
(%aliases))
- #:author-date (commit-author-date commit))
+ #:author-date (commit-author-date commit)
+ ;; The snippet source text excludes the
+ ;; first paragraph (i.e., the summary line)
+ ;; of the commit. Hence, we use commit-body.
+ #:snippet-source-text
+ (commit-body
+ (commit-lookup (current-git-repository)
+ (commit-id commit))))
result))
(list)
repository))