From 1e43f1a12eb7332d821f480028ae3b5633b35143 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Fri, 24 Feb 2023 04:01:51 -0600 Subject: [PATCH] Use new config/types API to set enabled content types in khoj.el menu --- src/interface/emacs/khoj.el | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/interface/emacs/khoj.el b/src/interface/emacs/khoj.el index 7b4c876f..f6fba071 100644 --- a/src/interface/emacs/khoj.el +++ b/src/interface/emacs/khoj.el @@ -262,19 +262,15 @@ Use `which-key` if available, else display simple message in echo area" (defun khoj--get-enabled-content-types () "Get content types enabled for search from API." - (let ((config-url (format "%s/api/config/data" khoj-server-url)) + (let ((config-url (format "%s/api/config/types" khoj-server-url)) (url-request-method "GET")) (with-temp-buffer (erase-buffer) (url-insert-file-contents config-url) - (let* ((json-response (json-parse-buffer :object-type 'alist)) - (content-type (cdr (assoc 'content-type json-response)))) - ;; return content-type items with configuration - (mapcar - #'car - (cl-remove-if-not - (lambda (a) (not (eq (cdr a) :null))) - content-type)))))) + (thread-last + (json-parse-buffer :object-type 'alist) + (mapcar 'downcase) + (mapcar 'intern))))) (defun khoj--construct-api-query (query content-type &optional rerank) "Construct API Query from QUERY, CONTENT-TYPE and (optional) RERANK params."