Fix querying with include word filter from web interface

- Not encoding the `query' string before querying the backend API with
  it was causing the "+" prefix for include word filter to be lost
This commit is contained in:
Debanjum Singh Solanky 2022-09-12 09:27:02 +03:00
parent 1502fbc9e9
commit c6fa09d8fc

View file

@ -63,10 +63,10 @@
function search(rerank=false) { function search(rerank=false) {
query = document.getElementById("query").value; query = document.getElementById("query").value;
type = document.getElementById("type").value; type = document.getElementById("type").value;
console.log(query, type); console.log(`Query: ${query}, Type: ${type}`);
url = type === "image" url = type === "image"
? `/search?q=${query}&t=${type}&n=6` ? `/search?q=${encodeURIComponent(query)}&t=${type}&n=6`
: `/search?q=${query}&t=${type}&n=6&r=${rerank}`; : `/search?q=${encodeURIComponent(query)}&t=${type}&n=6&r=${rerank}`;
fetch(url) fetch(url)
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {