Skip to content

Commit

Permalink
feat: allow searching without keywords (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Feb 19, 2024
1 parent 9c53a70 commit 714daf9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
12 changes: 5 additions & 7 deletions assets/search/js/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,10 @@ class Engine {
* @param {string} lang
*/
private pattern(query: string, lang: string, years: Array<string> = [], taxonomies: Record<string, Array<string>> = {}): string | Record<string, unknown> {
if (lang === '') {
return query
}
const p: Array<Record<string, unknown>> = []

const p: Array<Record<string, unknown>> = [
{
if (query !== '') {
p.push({
"$or": [
{ title: query },
{ summary: query },
Expand All @@ -141,8 +139,8 @@ class Engine {
"$val": query
},
]
},
]
})
}

if (lang) {
p.push({
Expand Down
4 changes: 0 additions & 4 deletions assets/search/js/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,6 @@ export default class Form {
private submit() {
const query = this.getQuery()
this.updatePage(query)
if (query === '') {
this.renderer.render(query, [], 0)
return
}

this.spinner.show()
const sorting = this.getSorting()
Expand Down

0 comments on commit 714daf9

Please sign in to comment.