mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 13:25:11 +00:00
Encode query string before passing as query param to search API
This commit is contained in:
@@ -51,7 +51,8 @@ export class KhojModal extends SuggestModal<SearchResult> {
|
|||||||
|
|
||||||
async getSuggestions(query: string): Promise<SearchResult[]> {
|
async getSuggestions(query: string): Promise<SearchResult[]> {
|
||||||
// Query Khoj backend for search results
|
// Query Khoj backend for search results
|
||||||
let searchUrl = `${this.setting.khojUrl}/api/search?q=${query}&n=${this.setting.resultsCount}&r=${this.rerank}&t=markdown`
|
let encodedQuery = encodeURIComponent(query);
|
||||||
|
let searchUrl = `${this.setting.khojUrl}/api/search?q=${encodedQuery}&n=${this.setting.resultsCount}&r=${this.rerank}&t=markdown`
|
||||||
let results = await request(searchUrl)
|
let results = await request(searchUrl)
|
||||||
.then(response => JSON.parse(response))
|
.then(response => JSON.parse(response))
|
||||||
.then(data => data
|
.then(data => data
|
||||||
|
|||||||
Reference in New Issue
Block a user