mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 05:39:12 +00:00
Return value of search_type in /config/type API endpoint
- Remove need for interfaces to downcase content types returned by API before using the type in search and other API endpoint - Fix to check for search_type.name in plugin keys instead of value
This commit is contained in:
@@ -281,7 +281,6 @@ Use `which-key` if available, else display simple message in echo area"
|
|||||||
(url-insert-file-contents config-url)
|
(url-insert-file-contents config-url)
|
||||||
(thread-last
|
(thread-last
|
||||||
(json-parse-buffer :object-type 'alist)
|
(json-parse-buffer :object-type 'alist)
|
||||||
(mapcar 'downcase)
|
|
||||||
(mapcar 'intern)))))
|
(mapcar 'intern)))))
|
||||||
|
|
||||||
(defun khoj--construct-api-query (query content-type &optional rerank)
|
(defun khoj--construct-api-query (query content-type &optional rerank)
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
function search(rerank=false) {
|
function search(rerank=false) {
|
||||||
// Extract required fields for search from form
|
// Extract required fields for search from form
|
||||||
query = document.getElementById("query").value.trim();
|
query = document.getElementById("query").value.trim();
|
||||||
type = document.getElementById("type").value.toLowerCase();
|
type = document.getElementById("type").value;
|
||||||
results_count = document.getElementById("results-count").value || 6;
|
results_count = document.getElementById("results-count").value || 6;
|
||||||
console.log(`Query: ${query}, Type: ${type}`);
|
console.log(`Query: ${query}, Type: ${type}`);
|
||||||
|
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ def get_default_config_data():
|
|||||||
def get_config_types():
|
def get_config_types():
|
||||||
"""Get configured content types"""
|
"""Get configured content types"""
|
||||||
return [
|
return [
|
||||||
search_type.name
|
search_type.value
|
||||||
for search_type in SearchType
|
for search_type in SearchType
|
||||||
if any(search_type.value == configured_content_type[0] for configured_content_type in state.config.content_type)
|
if any(search_type.value == configured_content_type[0] for configured_content_type in state.config.content_type)
|
||||||
or search_type.value in state.config.content_type.plugins.keys()
|
or search_type.name in state.config.content_type.plugins.keys()
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user