◊(Local Yarn Code "Check-in [70bf798f]")

Overview
Comment:Bugfix cache-index-entries-only!, add to docs
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 70bf798fa58c5f33cd36a73fe6e9bee8e2426f73e55f607beefa1be5ef8c5031
User & Date: joel on 2020-05-11 01:55:38
Other Links: manifest | tags
Context
2020-05-11
01:56
Make most article columns nullable check-in: f59aba82 user: joel tags: trunk
01:55
Bugfix cache-index-entries-only!, add to docs check-in: 70bf798f user: joel tags: trunk
2020-05-10
21:36
Collect cache INSERTs in a transaction, delegate to a thread check-in: 187278e6 user: joel tags: trunk
Changes

Modified code-docs/crystalize.scrbl from [d002cd00] to [a0674cea].

21
22
23
24
25
26
27
28
29


30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48













21
22
23
24
25
26
27


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61







-
-
+
+



















+
+
+
+
+
+
+
+
+
+
+
+
+

“Crystalizing” is an extra layer in between docs and templates that destructures the @tt{doc} and
stores it in various pieces in a SQLite cache. Individual articles save chunks of rendered HTML to
the cache when their individual pages are rendered. When pulling together listings of articles in
different contexts that need to be filtered and sorted, a SQL query is much faster than trolling
through the Pollen cache for matching docs and regenerating the HTML.

@margin-note{These functions are designed to be used within the template for articles and series,
respectively, so that the cache is updated precisely when the web page is rendered.}
@margin-note{These functions are designed to be used within templates, so that the rows in the cache
database for a page are updated right when that web page is rendered.}

@defproc[(parse-and-cache-article! [pagenode pagenode?] [doc txexpr?]) 
         (values non-empty-string? non-empty-string?)]{

Returns two values: the “plain” title of the article, and a string containing the full HTML of
@racket[_doc], in that order.

The title is returned separately for use in the HTML @tt{<title>} tag. If the @racket[_doc] doesn’t
specify a title, a provisional title is constructed using @racket[default-title].

Privately, it does a lot of other work. The article is analyzed, additional metadata is constructed
and saved to the SQLite cache and saved using @racket[make-cache:article]. If the article specifies
a @racket['series] meta, information about that series is fetched and used in the rendering of the
article. If there are @racket[note]s or @racket[index] tags in the doc, they are parsed and saved
individually to the SQLite cache (using @racket[make-cache:note] and
@racket[make-cache:index-entry]). If any of the notes use the @code{#:disposition} attribute,
information about the disposition is parsed out and used in the rendering of the article. 

}

@defproc[(cache-index-entries-only! [title string?] [page pagenode?] [doc txexpr?]) void?]{

Saves only the @racket[index] entres in @racket[_doc] to the cache database, so that they appear in
the keyword index.

This function allows pages that are not @tech{articles} to have their own keyword index entries, and
should be used in the templates for such pages.

As a side effect of calling this function, a minimal @racket[cache:article] is created for the page
with its @racket['conceal] meta set to @racket{all}, to exclude it from any listings.

}

Modified crystalize.rkt from [18b3b766] to [4e54a177].

273
274
275
276
277
278
279

280
281
282
283

284
273
274
275
276
277
278
279
280
281
282
283

284
285







+



-
+

  (void
   (thread
    (lambda ()
      (call-with-transaction
       (cache-conn)
       (lambda ()
         (cache-index-entries! pagenode doc)
         (delete-article! pagenode)
         (insert-one! (cache-conn)
                       (make-cache:article
                        #:title-plain title
                        #:conceal (maybe-meta 'conceal)
                        #:conceal "blog,feed"
                        #:page pagenode))))))))