mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-24 07:55:07 +01:00
Get Khoj search-types enabled by user in Emacs
This commit is contained in:
parent
f3c1512c38
commit
6dc9801f45
1 changed files with 14 additions and 0 deletions
|
@ -180,6 +180,20 @@ Use `which-key` if available, else display simple message in echo area"
|
||||||
((or (equal file-extension "markdown") (equal file-extension "md")) "markdown")
|
((or (equal file-extension "markdown") (equal file-extension "md")) "markdown")
|
||||||
(t "org"))))
|
(t "org"))))
|
||||||
|
|
||||||
|
(defun khoj--get-enabled-search-types ()
|
||||||
|
(let ((config-url (format "%s/config/data" khoj--server-url)))
|
||||||
|
(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))))))
|
||||||
|
|
||||||
(defun khoj--construct-api-query (query search-type &optional rerank)
|
(defun khoj--construct-api-query (query search-type &optional rerank)
|
||||||
(let ((rerank (or rerank "false"))
|
(let ((rerank (or rerank "false"))
|
||||||
(results-count (or khoj--results-count 5))
|
(results-count (or khoj--results-count 5))
|
||||||
|
|
Loading…
Reference in a new issue