diff --git a/src/search.lisp b/src/search.lisp index c41871e..7e348ab 100644 --- a/src/search.lisp +++ b/src/search.lisp @@ -15,7 +15,8 @@ #:submit-entry #:set-filter-attributes #:delete-all-entries - #:create-dump)) + #:create-dump + #:update-ranking-rules)) (in-package #:search) ;; Explains the "~{~A~^,~}" in the format call below. @@ -136,3 +137,11 @@ has requested. She would like the filtering to consist on years and months." "Creates a dump of the Meilisearch database." (utils:run-bash-command (format nil "curl -X POST \'~a\'" (build-search-url "/dumps")))) + +(defun update-ranking-rules () + "Updates the way Meilisearch ranks and orders the search results. +The main intention for this function is to show the latest entries into the +database first (when no search term is entered by the user)." + (utils:run-bash-command + (format nil "curl -X PATCH \'~a\' -H \'Authorization: ~a\' -H \'Content-Type: application/json\' --data-binary \'[ \"words\", \"typo\", \"proximity\", \"attribute\", \"sort\", \"exactness\",\"rank:asc\", \"year:desc\" ]\'" + (build-search-url "/indexes/nera/settings") (meilisearch-api-key))))