summaryrefslogtreecommitdiff
path: root/tissue/document.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tissue/document.scm')
-rw-r--r--tissue/document.scm22
1 files changed, 10 insertions, 12 deletions
diff --git a/tissue/document.scm b/tissue/document.scm
index c05e40f..1e55e67 100644
--- a/tissue/document.scm
+++ b/tissue/document.scm
@@ -133,7 +133,9 @@ mutate @var{object}."
(define-class <document> ()
(title #:accessor document-title #:init-keyword #:title)
- (web-uri #:accessor document-web-uri #:init-keyword #:web-uri))
+ (web-uri #:accessor document-web-uri #:init-keyword #:web-uri)
+ (snippet-source-text #:accessor document-snippet-source-text
+ #:init-keyword #:snippet-source-text))
(define-generic document-id-term)
(define-generic document-text)
@@ -173,21 +175,17 @@ and further text, increase-termpos! must be called before indexing."
(index-text! term-generator (document-text document))
term-generator))
-(define-method (document-snippet-source-text (document <document>))
- "Return the source text for DOCUMENT from which to extract a search
-result snippet."
- ;; Remove blank lines from document text.
- (string-join
- (remove string-blank?
- (string-split (document-text document)
- #\newline))
- "\n"))
-
(define (document-html-snippet document mset)
"Return snippet for DOCUMENT. MSET is the xapian MSet object
representing a list of search results."
(mset-snippet mset
- (document-snippet-source-text document)
+ ;; Remove blank lines from text.
+ (string-join
+ (remove string-blank?
+ (string-split
+ (document-snippet-source-text document)
+ #\newline))
+ "\n")
#:length 200
#:highlight-start "<b>"
#:highlight-end "</b>"