Skip to content

Commit

Permalink
require query to be a miniumum of three characters
Browse files Browse the repository at this point in the history
Signed-off-by: Sarah Funkhouser <[email protected]>
  • Loading branch information
golanglemonade committed Sep 9, 2024
1 parent e7713c3 commit 4f53a87
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions searchgen/templates/resolver.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ func (r *queryResolver) Search(ctx context.Context, query string) (*SearchResult
{{- else }}
func (r *queryResolver) {{ $.Name }}Search(ctx context.Context, query string) (*SearchResultConnection, error) {
{{- end }}
if len(query) < 3 {
return nil, ErrSearchQueryTooShort
}

var (
errors []error
{{- range $object := $.Objects }}
Expand Down

0 comments on commit 4f53a87

Please sign in to comment.