mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 16:14:21 +00:00
Add rerank, index corruption hint on search page of web interface
Similar to the hint alrady in the Obsidian search modal Closes #272
This commit is contained in:
parent
4b79d8216f
commit
571e8c2548
1 changed files with 21 additions and 3 deletions
|
@ -112,12 +112,15 @@
|
||||||
// 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;
|
type = document.getElementById("type").value;
|
||||||
|
searchHint = document.getElementById("info-hint");
|
||||||
results_count = localStorage.getItem("khojResultsCount");
|
results_count = localStorage.getItem("khojResultsCount");
|
||||||
console.log(`Query: ${query}, Type: ${type}, Results Count: ${results_count}`);
|
console.log(`Query: ${query}, Type: ${type}, Results Count: ${results_count}`);
|
||||||
|
|
||||||
// Short circuit on empty query
|
// Short circuit on empty query
|
||||||
if (query.length === 0)
|
if (query.length === 0) {
|
||||||
|
searchHint.style.display = "none";
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If set query field in url query param on rerank
|
// If set query field in url query param on rerank
|
||||||
if (rerank)
|
if (rerank)
|
||||||
|
@ -131,6 +134,8 @@
|
||||||
console.log(data);
|
console.log(data);
|
||||||
document.getElementById("results").innerHTML = render_results(data, query, type);
|
document.getElementById("results").innerHTML = render_results(data, query, type);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setTimeout(() => { searchHint.style.display = "block"; }, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function incrementalSearch(event) {
|
function incrementalSearch(event) {
|
||||||
|
@ -247,6 +252,12 @@
|
||||||
<select id="type" class="option" onchange="setTypeFieldInUrl(this)"></select>
|
<select id="type" class="option" onchange="setTypeFieldInUrl(this)"></select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!--Add Hints to Guide Search -->
|
||||||
|
<div id="info-hint" style="display: none">
|
||||||
|
Unexpected results? Hit Enter to get better results.
|
||||||
|
Else click Reinitialize on the <a href="/config">settings page</a> to fix it.
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Section to Render Results -->
|
<!-- Section to Render Results -->
|
||||||
<div id="results"></div>
|
<div id="results"></div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -256,7 +267,7 @@
|
||||||
body {
|
body {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
grid-template-rows: 1fr auto auto minmax(80px, 100%);
|
grid-template-rows: 1fr auto auto auto minmax(80px, 100%);
|
||||||
}
|
}
|
||||||
body > * {
|
body > * {
|
||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
|
@ -266,7 +277,7 @@
|
||||||
body {
|
body {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr min(70vw, 100%) 1fr;
|
grid-template-columns: 1fr min(70vw, 100%) 1fr;
|
||||||
grid-template-rows: 1fr auto auto minmax(80px, 100%);
|
grid-template-rows: 1fr auto auto auto minmax(80px, 100%);
|
||||||
padding-top: 60vw;
|
padding-top: 60vw;
|
||||||
}
|
}
|
||||||
body > * {
|
body > * {
|
||||||
|
@ -308,6 +319,13 @@
|
||||||
#query {
|
#query {
|
||||||
font-size: larger;
|
font-size: larger;
|
||||||
}
|
}
|
||||||
|
#info-hint {
|
||||||
|
font-size: small;
|
||||||
|
color: #aaa;
|
||||||
|
text-align: center;
|
||||||
|
margin: 5px 0 0 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
#results {
|
#results {
|
||||||
font-size: medium;
|
font-size: medium;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
|
Loading…
Add table
Reference in a new issue