104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
-
+
|
(define (fetch-entries)
(define q
◊string-append{
SELECT entry, subentry, a.rowid, "◊web-root" || k.page || "#" || html_anchor AS href, title_plain
FROM index_entries k INNER JOIN articles a
ON a.page = k.page
ORDER BY entry COLLATE NOCASE ASC, subentry COLLATE NOCASE ASC;})
(query-rows cache-conn q))
(query-rows (cache-conn) q))
;; Convert a list of vectors from the cache DB into a list of the form:
;; ((FIRST-LETTER (entries ...)) ...)
;; The method relies on the records being pre-sorted by the SQL query.
(define (group-entries records)
(define collated
(for/fold ([entries (list (new-entry (first records)))]
|