diff --git a/src/khoj/interface/web/index.html b/src/khoj/interface/web/index.html
index 66ca85e1..98914397 100644
--- a/src/khoj/interface/web/index.html
+++ b/src/khoj/interface/web/index.html
@@ -63,7 +63,7 @@
function search(rerank=false) {
// Extract required fields for search from form
query = document.getElementById("query").value.trim();
- type = document.getElementById("type").value;
+ type = document.getElementById("type").value.toLowerCase();
results_count = document.getElementById("results-count").value || 6;
console.log(`Query: ${query}, Type: ${type}`);
@@ -116,21 +116,21 @@
}
function populate_type_dropdown() {
- // Populate type dropdown field with enabled search types only
- var possible_search_types = ["org", "markdown", "ledger", "music", "image"];
- fetch("/api/config/data")
+ // Populate type dropdown field with enabled content types only
+ fetch("/api/config/types")
.then(response => response.json())
- .then(data => {
+ .then(enabled_types => {
document.getElementById("type").innerHTML =
- possible_search_types
- .filter(type => data["content-type"].hasOwnProperty(type) && data["content-type"][type])
+ enabled_types
.map(type => ``)
.join('');
+
+ return enabled_types;
})
- .then(() => {
- // Set type field to search type passed in URL query parameter, if valid
+ .then(enabled_types => {
+ // Set type field to content type passed in URL query parameter, if valid
var type_via_url = new URLSearchParams(window.location.search).get("t");
- if (type_via_url && possible_search_types.includes(type_via_url))
+ if (type_via_url && enabled_types.includes(type_via_url))
document.getElementById("type").value = type_via_url;
});
}
@@ -154,7 +154,7 @@
}
window.onload = function () {
- // Dynamically populate type dropdown based on enabled search types and type passed as URL query parameter
+ // Dynamically populate type dropdown based on enabled content types and type passed as URL query parameter
populate_type_dropdown();
// Set results count field with value passed in URL query parameters, if any.