36 lines
756 B
Go
36 lines
756 B
Go
|
|
package model
|
||
|
|
|
||
|
|
type MatchResult struct {
|
||
|
|
Product Product `json:"product"`
|
||
|
|
Score float64 `json:"score"`
|
||
|
|
Details ScoreDetail `json:"details"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type ScoreDetail struct {
|
||
|
|
Visual float64 `json:"visual"`
|
||
|
|
Material float64 `json:"material"`
|
||
|
|
Price float64 `json:"price"`
|
||
|
|
Category float64 `json:"category"`
|
||
|
|
GroupPenalty float64 `json:"group_penalty"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type EngineConfig struct {
|
||
|
|
MinScore float64
|
||
|
|
MaxResults int
|
||
|
|
WeightVisual float64
|
||
|
|
WeightMaterial float64
|
||
|
|
WeightPrice float64
|
||
|
|
WeightCategory float64
|
||
|
|
}
|
||
|
|
|
||
|
|
func DefaultEngineConfig() EngineConfig {
|
||
|
|
return EngineConfig{
|
||
|
|
MinScore: 70,
|
||
|
|
MaxResults: 10,
|
||
|
|
WeightVisual: 40,
|
||
|
|
WeightMaterial: 30,
|
||
|
|
WeightPrice: 20,
|
||
|
|
WeightCategory: 10,
|
||
|
|
}
|
||
|
|
}
|