Skip to content

Commit

Permalink
add options for allow_leading_wildcard
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevins Bartolomeo committed Apr 28, 2022
1 parent 20c81dc commit 1646441
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions opensearchapi/api.search.go
Expand Up @@ -63,6 +63,7 @@ type SearchRequest struct {

AllowNoIndices *bool
AllowPartialSearchResults *bool
AllowLeadingWildcard *bool
Analyzer string
AnalyzeWildcard *bool
BatchedReduceSize *int
Expand Down Expand Up @@ -148,6 +149,10 @@ func (r SearchRequest) Do(ctx context.Context, transport Transport) (*Response,
params["allow_partial_search_results"] = strconv.FormatBool(*r.AllowPartialSearchResults)
}

if r.AllowLeadingWildcard != nil {
params["allow_leading_wildcard"] = strconv.FormatBool(*r.AllowLeadingWildcard)
}

if r.Analyzer != "" {
params["analyzer"] = r.Analyzer
}
Expand Down Expand Up @@ -431,6 +436,14 @@ func (f Search) WithAnalyzer(v string) func(*SearchRequest) {
}
}

// WithAllowLeadingWildcard - the wildcard characters * and ? are allowed as the first character of the query string.
//
func (f Search) WithAllowLeadingWildcard(v bool) func(*SearchRequest) {
return func(r *SearchRequest) {
r.AllowLeadingWildcard = &v
}
}

// WithAnalyzeWildcard - specify whether wildcard and prefix queries should be analyzed (default: false).
//
func (f Search) WithAnalyzeWildcard(v bool) func(*SearchRequest) {
Expand Down

0 comments on commit 1646441

Please sign in to comment.