Change order of arg passed to query-api-and-render-results by importance

This commit is contained in:
Debanjum Singh Solanky 2023-01-20 22:11:00 -03:00
parent 936a88fa7e
commit b7aa22a059

View file

@ -275,9 +275,8 @@ Use `which-key` if available, else display simple message in echo area"
(encoded-query (url-hexify-string query))) (encoded-query (url-hexify-string query)))
(format "%s/api/search?q=%s&t=%s&r=%s&n=%s" khoj-server-url encoded-query content-type rerank khoj-results-count))) (format "%s/api/search?q=%s&t=%s&r=%s&n=%s" khoj-server-url encoded-query content-type rerank khoj-results-count)))
(defun khoj--query-api-and-render-results (query content-type query-url buffer-name) (defun khoj--query-api-and-render-results (query-url content-type query buffer-name)
"Query Khoj API using QUERY, CONTENT-TYPE, QUERY-URL. "Query Khoj QUERY-URL. Render results in BUFFER-NAME using QUERY, CONTENT-TYPE."
Render results in BUFFER-NAME."
;; get json response from api ;; get json response from api
(with-current-buffer buffer-name (with-current-buffer buffer-name
(let ((inhibit-read-only t) (let ((inhibit-read-only t)
@ -335,9 +334,9 @@ Render results in BUFFER-NAME."
(setq khoj--rerank t) (setq khoj--rerank t)
(message "Khoj: Rerank Results")) (message "Khoj: Rerank Results"))
(khoj--query-api-and-render-results (khoj--query-api-and-render-results
query
khoj--content-type
query-url query-url
khoj--content-type
query
khoj-buffer-name)))))) khoj-buffer-name))))))
(defun khoj--delete-open-network-connections-to-server () (defun khoj--delete-open-network-connections-to-server ()
@ -438,9 +437,9 @@ Render results in BUFFER-NAME."
(buffer-name (get-buffer-create khoj--buffer-name))) (buffer-name (get-buffer-create khoj--buffer-name)))
(progn (progn
(khoj--query-api-and-render-results (khoj--query-api-and-render-results
query-title
content-type
query-url query-url
content-type
query-title
buffer-name) buffer-name)
(switch-to-buffer buffer-name) (switch-to-buffer buffer-name)
(goto-char (point-min))))) (goto-char (point-min)))))