Browse Source

implement set-filter-attributes, delete-all-entries and create-dump.

These functions are helper functions to manage the Meiliseach database from
a Common Lisp perspective. The intention is to work them into the website's
back-end so the user can reset or re-populate the database from the website
without me (or someone else) having to SSH into the VM and do fix/restore things
manually. For now, they allow you to manage the database from SLIME.
stable
Craig Oates 2 years ago
parent
commit
6e4da8dc26
  1. 15
      src/search.lisp

15
src/search.lisp

@ -13,7 +13,9 @@
#:get-id
#:get-keywords
#:submit-entry
#:set-filter-attributes))
#:set-filter-attributes
#:delete-all-entries
#:create-dump))
(in-package #:search)
;; Explains the "~{~A~^,~}" in the format call below.
@ -124,3 +126,14 @@ has requested. She would like the filtering to consist on years and months."
(utils:run-bash-command
(format nil "curl -X PATCH \'~a\' -H \'Authorization: ~a\' -H \'Content-Type: application/json\' --data-binary \'{ \"filterableAttributes\": [ \"year\", \"month\", \"keywords\" ]}\'"
(build-search-url "/indexes/nera/settings") (meilisearch-api-key))))
(defun delete-all-entries ()
"Deletes all the archive entries in the Meilisearch database -- not the DB."
(utils:run-bash-command
(format nil "curl -X DELETE \'~a\'"
(build-search-url "/indexes/nera/documents"))))
(defun create-dump ()
"Creates a dump of the Meilisearch database."
(utils:run-bash-command
(format nil "curl -X POST \'~a\'" (build-search-url "/dumps"))))

Loading…
Cancel
Save