mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Encode query string before passing as query param to search API
This commit is contained in:
parent
d5a7cc5b0f
commit
ffaef92476
1 changed files with 2 additions and 1 deletions
|
@ -51,7 +51,8 @@ export class KhojModal extends SuggestModal<SearchResult> {
|
|||
|
||||
async getSuggestions(query: string): Promise<SearchResult[]> {
|
||||
// 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)
|
||||
.then(response => JSON.parse(response))
|
||||
.then(data => data
|
||||
|
|
Loading…
Add table
Reference in a new issue