From 6e2cb00008cbf09e556b00f87603797fcaa47e09 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 16 Apr 2018 05:37:14 -0700 Subject: Depenancy upgrades and movign to dep. (#8630) --- .../olivere/elastic/search_queries_boosting.go | 97 ---------------------- 1 file changed, 97 deletions(-) delete mode 100644 vendor/github.com/olivere/elastic/search_queries_boosting.go (limited to 'vendor/github.com/olivere/elastic/search_queries_boosting.go') diff --git a/vendor/github.com/olivere/elastic/search_queries_boosting.go b/vendor/github.com/olivere/elastic/search_queries_boosting.go deleted file mode 100644 index 0060a30a8..000000000 --- a/vendor/github.com/olivere/elastic/search_queries_boosting.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2012-present Oliver Eilhard. All rights reserved. -// Use of this source code is governed by a MIT-license. -// See http://olivere.mit-license.org/license.txt for details. - -package elastic - -// A boosting query can be used to effectively -// demote results that match a given query. -// For more details, see: -// https://www.elastic.co/guide/en/elasticsearch/reference/6.0/query-dsl-boosting-query.html -type BoostingQuery struct { - Query - positiveClause Query - negativeClause Query - negativeBoost *float64 - boost *float64 -} - -// Creates a new boosting query. -func NewBoostingQuery() *BoostingQuery { - return &BoostingQuery{} -} - -func (q *BoostingQuery) Positive(positive Query) *BoostingQuery { - q.positiveClause = positive - return q -} - -func (q *BoostingQuery) Negative(negative Query) *BoostingQuery { - q.negativeClause = negative - return q -} - -func (q *BoostingQuery) NegativeBoost(negativeBoost float64) *BoostingQuery { - q.negativeBoost = &negativeBoost - return q -} - -func (q *BoostingQuery) Boost(boost float64) *BoostingQuery { - q.boost = &boost - return q -} - -// Creates the query source for the boosting query. -func (q *BoostingQuery) Source() (interface{}, error) { - // { - // "boosting" : { - // "positive" : { - // "term" : { - // "field1" : "value1" - // } - // }, - // "negative" : { - // "term" : { - // "field2" : "value2" - // } - // }, - // "negative_boost" : 0.2 - // } - // } - - query := make(map[string]interface{}) - - boostingClause := make(map[string]interface{}) - query["boosting"] = boostingClause - - // Negative and positive clause as well as negative boost - // are mandatory in the Java client. - - // positive - if q.positiveClause != nil { - src, err := q.positiveClause.Source() - if err != nil { - return nil, err - } - boostingClause["positive"] = src - } - - // negative - if q.negativeClause != nil { - src, err := q.negativeClause.Source() - if err != nil { - return nil, err - } - boostingClause["negative"] = src - } - - if q.negativeBoost != nil { - boostingClause["negative_boost"] = *q.negativeBoost - } - - if q.boost != nil { - boostingClause["boost"] = *q.boost - } - - return query, nil -} -- cgit v1.2.3-1-g7c22