Browse Source

add 'update'ranking-rules' func. to search package.

This allows you to change the order the search results are returned in. The main
purpose why you would want to use this function in this context is to make sure
the list of results is ordered by the year the artworks where published/created.
stable
Craig Oates 2 years ago
parent
commit
2d862e29e2
  1. 11
      src/search.lisp

11
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))))

Loading…
Cancel
Save