105 lines
4.0 KiB
Go
105 lines
4.0 KiB
Go
// Package constants define constant variable
|
|
package constants
|
|
|
|
const (
|
|
// DefaultScore define the default score for redissearch suggestion
|
|
DefaultScore = 1.0
|
|
)
|
|
|
|
const (
|
|
// RedisAllGridSetKey define redis set key which store all grid tag keys
|
|
RedisAllGridSetKey = "grid_tag_keys"
|
|
|
|
// RedisAllZoneSetKey define redis set key which store all zone tag keys
|
|
RedisAllZoneSetKey = "zone_tag_keys"
|
|
|
|
// RedisAllStationSetKey define redis set key which store all station tag keys
|
|
RedisAllStationSetKey = "station_tag_keys"
|
|
|
|
// RedisAllCompNSPathSetKey define redis set key which store all component nspath keys
|
|
RedisAllCompNSPathSetKey = "component_nspath_keys"
|
|
|
|
// RedisAllCompTagSetKey define redis set key which store all component tag keys
|
|
RedisAllCompTagSetKey = "component_tag_keys"
|
|
|
|
// RedisAllConfigSetKey define redis set key which store all config keys
|
|
RedisAllConfigSetKey = "config_keys"
|
|
|
|
// RedisAllMeasTagSetKey define redis set key which store all measurement tag keys
|
|
RedisAllMeasTagSetKey = "measurement_tag_keys"
|
|
|
|
// RedisSpecGridZoneSetKey define redis set key which store all zone tag keys under specific grid
|
|
RedisSpecGridZoneSetKey = "%s_zone_tag_keys"
|
|
|
|
// RedisSpecZoneStationSetKey define redis set key which store all station tag keys under specific zone
|
|
RedisSpecZoneStationSetKey = "%s_station_tag_keys"
|
|
|
|
// RedisSpecStationCompNSPATHSetKey define redis set key which store all component nspath keys under specific station
|
|
RedisSpecStationCompNSPATHSetKey = "%s_component_nspath_keys"
|
|
|
|
// RedisSpecCompNSPathCompTagSetKey define redis set key which store all component tag keys under specific component nspath
|
|
RedisSpecCompNSPathCompTagSetKey = "%s_component_tag_keys"
|
|
|
|
// RedisSpecCompTagMeasSetKey define redis set key which store all measurement tag keys under specific component tag
|
|
RedisSpecCompTagMeasSetKey = "%s_measurement_tag_keys"
|
|
)
|
|
|
|
const (
|
|
// SearchLinkAddAction define search link add action
|
|
SearchLinkAddAction = "add"
|
|
// SearchLinkDelAction define search link del action
|
|
SearchLinkDelAction = "del"
|
|
)
|
|
|
|
// RecommendHierarchyType define the hierarchy levels used for redis recommend search
|
|
type RecommendHierarchyType int
|
|
|
|
const (
|
|
// GridRecommendHierarchyType define grid hierarch for redis recommend search
|
|
GridRecommendHierarchyType RecommendHierarchyType = iota + 1
|
|
// ZoneRecommendHierarchyType define zone hierarch for redis recommend search
|
|
ZoneRecommendHierarchyType
|
|
// StationRecommendHierarchyType define station hierarch for redis recommend search
|
|
StationRecommendHierarchyType
|
|
// CompNSPathRecommendHierarchyType define component nspath hierarch for redis recommend search
|
|
CompNSPathRecommendHierarchyType
|
|
// CompTagRecommendHierarchyType define component tag hierarch for redis recommend search
|
|
CompTagRecommendHierarchyType
|
|
// ConfigRecommendHierarchyType define config hierarch for redis recommend search
|
|
ConfigRecommendHierarchyType
|
|
// MeasTagRecommendHierarchyType define measurement tag hierarch for redis recommend search
|
|
MeasTagRecommendHierarchyType
|
|
)
|
|
|
|
// String implements fmt.Stringer interface and returns the string representation of the type.
|
|
func (r RecommendHierarchyType) String() string {
|
|
switch r {
|
|
case GridRecommendHierarchyType:
|
|
return "grid_tag"
|
|
case ZoneRecommendHierarchyType:
|
|
return "zone_tag"
|
|
case StationRecommendHierarchyType:
|
|
return "station_tag"
|
|
case CompNSPathRecommendHierarchyType:
|
|
return "comp_nspath"
|
|
case CompTagRecommendHierarchyType:
|
|
return "comp_tag"
|
|
case ConfigRecommendHierarchyType:
|
|
return "config"
|
|
case MeasTagRecommendHierarchyType:
|
|
return "meas_tag"
|
|
default:
|
|
// 返回一个包含原始数值的默认字符串,以便于调试
|
|
return "unknown_recommend_type(" + string(rune(r)) + ")"
|
|
}
|
|
}
|
|
|
|
const (
|
|
// FullRecommendLength define full recommend length with all tokens
|
|
FullRecommendLength = "t1.t2.t3.t4.t5.t6.t7"
|
|
// IsLocalRecommendLength define is local recommend length with specific tokens
|
|
IsLocalRecommendLength = "t4.t5.t6.t7"
|
|
// token1.token2.token3.token4.token7
|
|
// token4.token7
|
|
)
|