Skip to content

Commit

Permalink
Don't run guide search when input has only 1 character
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere committed Jan 12, 2024
1 parent 6a88482 commit d73e7c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ twitter_username: quarkusio
github_username: quarkusio
github_fork_url: "https://github.com/quarkusio/quarkus"
search:
# The minimum number of characters before we rely on remote search
# Below this, we rely on Javascript search
# The minimum number of characters before we run a full search.
# Below this:
# - if another filter is selected (e.g. categories), we run Javascript search
# - otherwise, we don't run search and just display all guides
min-chars: 2
# The URL of the remote search service
url: "https://search.quarkus.io/"
Expand Down
2 changes: 1 addition & 1 deletion assets/javascript/guides-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const app = createApp({
}
},
hasInput() {
return this.search.input.q || this.search.input.categories
return this.search.input.q && this.search.input.q.length >= this.minChars || this.search.input.categories
},
hasInputWithTooFewChars() {
return this.search.input.q && this.search.input.q.length < this.minChars
Expand Down

0 comments on commit d73e7c6

Please sign in to comment.