summaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in/olivere/elastic.v5/search_queries_query_string.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gopkg.in/olivere/elastic.v5/search_queries_query_string.go')
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_queries_query_string.go97
1 files changed, 44 insertions, 53 deletions
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_query_string.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_query_string.go
index 427e54c5b..a52c8b1a5 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/search_queries_query_string.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_query_string.go
@@ -11,37 +11,36 @@ import (
// QueryStringQuery uses the query parser in order to parse its content.
//
// For more details, see
-// https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-query-string-query.html
+// https://www.elastic.co/guide/en/elasticsearch/reference/6.0/query-dsl-query-string-query.html
type QueryStringQuery struct {
- queryString string
- defaultField string
- defaultOperator string
- analyzer string
- quoteAnalyzer string
- quoteFieldSuffix string
- autoGeneratePhraseQueries *bool
- allowLeadingWildcard *bool
- lowercaseExpandedTerms *bool
- enablePositionIncrements *bool
- analyzeWildcard *bool
- locale string
- boost *float64
- fuzziness string
- fuzzyPrefixLength *int
- fuzzyMaxExpansions *int
- fuzzyRewrite string
- phraseSlop *int
- fields []string
- fieldBoosts map[string]*float64
- useDisMax *bool
- tieBreaker *float64
- rewrite string
- minimumShouldMatch string
- lenient *bool
- queryName string
- timeZone string
- maxDeterminizedStates *int
- escape *bool
+ queryString string
+ defaultField string
+ defaultOperator string
+ analyzer string
+ quoteAnalyzer string
+ quoteFieldSuffix string
+ allowLeadingWildcard *bool
+ lowercaseExpandedTerms *bool // Deprecated: Decision is now made by the analyzer
+ enablePositionIncrements *bool
+ analyzeWildcard *bool
+ locale string // Deprecated: Decision is now made by the analyzer
+ boost *float64
+ fuzziness string
+ fuzzyPrefixLength *int
+ fuzzyMaxExpansions *int
+ fuzzyRewrite string
+ phraseSlop *int
+ fields []string
+ fieldBoosts map[string]*float64
+ tieBreaker *float64
+ rewrite string
+ minimumShouldMatch string
+ lenient *bool
+ queryName string
+ timeZone string
+ maxDeterminizedStates *int
+ escape *bool
+ typ string
}
// NewQueryStringQuery creates and initializes a new QueryStringQuery.
@@ -67,6 +66,13 @@ func (q *QueryStringQuery) Field(field string) *QueryStringQuery {
return q
}
+// Type sets how multiple fields should be combined to build textual part queries,
+// e.g. "best_fields".
+func (q *QueryStringQuery) Type(typ string) *QueryStringQuery {
+ q.typ = typ
+ return q
+}
+
// FieldWithBoost adds a field to run the query string against with a specific boost.
func (q *QueryStringQuery) FieldWithBoost(field string, boost float64) *QueryStringQuery {
q.fields = append(q.fields, field)
@@ -74,14 +80,6 @@ func (q *QueryStringQuery) FieldWithBoost(field string, boost float64) *QueryStr
return q
}
-// UseDisMax specifies whether to combine queries using dis max or boolean
-// query when more zhan one field is used with the query string. Defaults
-// to dismax (true).
-func (q *QueryStringQuery) UseDisMax(useDisMax bool) *QueryStringQuery {
- q.useDisMax = &useDisMax
- return q
-}
-
// TieBreaker is used when more than one field is used with the query string,
// and combined queries are using dismax.
func (q *QueryStringQuery) TieBreaker(tieBreaker float64) *QueryStringQuery {
@@ -119,15 +117,6 @@ func (q *QueryStringQuery) QuoteAnalyzer(quoteAnalyzer string) *QueryStringQuery
return q
}
-// AutoGeneratePhraseQueries indicates whether or not phrase queries will
-// be automatically generated when the analyzer returns more then one term
-// from whitespace delimited text. Set to false if phrase queries should only
-// be generated when surrounded by double quotes.
-func (q *QueryStringQuery) AutoGeneratePhraseQueries(autoGeneratePhraseQueries bool) *QueryStringQuery {
- q.autoGeneratePhraseQueries = &autoGeneratePhraseQueries
- return q
-}
-
// MaxDeterminizedState protects against too-difficult regular expression queries.
func (q *QueryStringQuery) MaxDeterminizedState(maxDeterminizedStates int) *QueryStringQuery {
q.maxDeterminizedStates = &maxDeterminizedStates
@@ -143,6 +132,8 @@ func (q *QueryStringQuery) AllowLeadingWildcard(allowLeadingWildcard bool) *Quer
// LowercaseExpandedTerms indicates whether terms of wildcard, prefix, fuzzy
// and range queries are automatically lower-cased or not. Default is true.
+//
+// Deprecated: Decision is now made by the analyzer.
func (q *QueryStringQuery) LowercaseExpandedTerms(lowercaseExpandedTerms bool) *QueryStringQuery {
q.lowercaseExpandedTerms = &lowercaseExpandedTerms
return q
@@ -233,6 +224,9 @@ func (q *QueryStringQuery) QueryName(queryName string) *QueryStringQuery {
return q
}
+// Locale specifies the locale to be used for string conversions.
+//
+// Deprecated: Decision is now made by the analyzer.
func (q *QueryStringQuery) Locale(locale string) *QueryStringQuery {
q.locale = locale
return q
@@ -282,9 +276,6 @@ func (q *QueryStringQuery) Source() (interface{}, error) {
if q.tieBreaker != nil {
query["tie_breaker"] = *q.tieBreaker
}
- if q.useDisMax != nil {
- query["use_dis_max"] = *q.useDisMax
- }
if q.defaultOperator != "" {
query["default_operator"] = q.defaultOperator
}
@@ -294,9 +285,6 @@ func (q *QueryStringQuery) Source() (interface{}, error) {
if q.quoteAnalyzer != "" {
query["quote_analyzer"] = q.quoteAnalyzer
}
- if q.autoGeneratePhraseQueries != nil {
- query["auto_generate_phrase_queries"] = *q.autoGeneratePhraseQueries
- }
if q.maxDeterminizedStates != nil {
query["max_determinized_states"] = *q.maxDeterminizedStates
}
@@ -354,6 +342,9 @@ func (q *QueryStringQuery) Source() (interface{}, error) {
if q.escape != nil {
query["escape"] = *q.escape
}
+ if q.typ != "" {
+ query["type"] = q.typ
+ }
return source, nil
}