feat(web/panettone): Support full-text search of issues

Support basic full text search of issues using postgresql's built-in
text search. There's a new column on the issues table called `tsv`,
which contains a tsvector of the title concatenated with the
description, and a new search form on both the index and closed issues
page which allows searching that tsvector with a user-supplied query.
Results are ranked according to that text query in the case of a search.

This works fine for now, but next up I'd also like to highlight the
results according to the bits that matched the user's query.

Change-Id: I25170bedbbbcdc3ed29a047962e9fcfe280d763a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11258
Autosubmit: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Aspen Smith 2024-03-24 14:31:47 -04:00 committed by aspen
parent 7f3d93942a
commit a80c0ce95f
7 changed files with 126 additions and 36 deletions

View file

@ -13,3 +13,26 @@ that it can be successfully decoded by the `BASE64' package"
(let* ((needed-padding (mod (length s) 4))
(pad-chars (if (zerop needed-padding) 0 (- 4 needed-padding))))
(format nil "~A~v@{~A~:*~}" s pad-chars "=")))
(defun and-where (clauses)
"Combine all non-nil clauses in CLAUSES into a single S-SQL WHERE form"
(if (null clauses) t
(reduce (lambda (x y) `(:and ,x ,y)) clauses)))
(defun and-where* (&rest clauses)
"Combine all non-nil clauses in CLAUSES into a single S-SQL WHERE form"
(and-where clauses))
(defmacro define-build-time-var
(name value-if-not-in-build &optional (doc nil))
`(defvar ,name
(or (when-let ((package (find-package :build)))
(let ((sym (find-symbol ,(symbol-name name))))
(when (boundp sym) (symbol-value sym))))
,value-if-not-in-build)
,doc))
(defun ->dir (dir)
(if (char-equal (uiop:last-char dir) #\/)
dir
(concatenate 'string dir "/")))