Merge pull request 'by Robin at 20240903' (#720) from feat-IRONFANS-198-Robin into main
Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/720
This commit is contained in:
commit
644b51e057
|
@ -378,7 +378,7 @@ func GetLastLessOrEqualForFloat64(arr []float64, target float64) int {
|
||||||
type Int64Filter struct {
|
type Int64Filter struct {
|
||||||
LowerBound *int64 `json:"lower_bound" bson:"lower_bound"`
|
LowerBound *int64 `json:"lower_bound" bson:"lower_bound"`
|
||||||
UpperBound *int64 `json:"upper_bound" bson:"upper_bound"`
|
UpperBound *int64 `json:"upper_bound" bson:"upper_bound"`
|
||||||
Scale float64 `json:"scale" bson:"scale"`
|
ScaleCoeff float64 `json:"scale_coeff" bson:"scale_coeff"`
|
||||||
Decay float64 `json:"decay" bson:"decay"`
|
Decay float64 `json:"decay" bson:"decay"`
|
||||||
Weight float64 `json:"weight" bson:"weight"`
|
Weight float64 `json:"weight" bson:"weight"`
|
||||||
}
|
}
|
||||||
|
@ -411,7 +411,8 @@ func CreateGaussDecayFunction(name string, filter *Int64Filter, refFilter *Int64
|
||||||
}
|
}
|
||||||
origin := float64(lb+ub) / 2
|
origin := float64(lb+ub) / 2
|
||||||
offset := float64(-lb+ub) / 2
|
offset := float64(-lb+ub) / 2
|
||||||
return elastic.NewGaussDecayFunction().FieldName(name).Origin(origin).Offset(offset).Scale(refFilter.Scale).Decay(refFilter.Decay).Weight(refFilter.Weight)
|
scale := (origin - offset) * refFilter.ScaleCoeff
|
||||||
|
return elastic.NewGaussDecayFunction().FieldName(name).Origin(origin).Offset(offset).Scale(scale).Decay(refFilter.Decay).Weight(refFilter.Weight)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateKeywordScriptScoreFunction(name string, value string, weight float64) *elastic.ScriptFunction {
|
func CreateKeywordScriptScoreFunction(name string, value string, weight float64) *elastic.ScriptFunction {
|
||||||
|
|
Loading…
Reference in New Issue