MCPcopy Create free account
hub / github.com/astercloud/aster / rebuildIndex

Method rebuildIndex

pkg/memory/preference.go:353–362  ·  view source on GitHub ↗

rebuildIndex 重建类别索引

()

Source from the content-addressed store, hash-verified

351
352// rebuildIndex 重建类别索引
353func (pm *PreferenceManager) rebuildIndex() {
354 pm.categoryIndex = make(map[string][]*Preference)
355
356 for userID, prefs := range pm.preferences {
357 for _, pref := range prefs {
358 indexKey := fmt.Sprintf("%s:%s", userID, pref.Category)
359 pm.categoryIndex[indexKey] = append(pm.categoryIndex[indexKey], pref)
360 }
361 }
362}
363
364// GetStats 获取统计信息
365func (pm *PreferenceManager) GetStats(userID string) PreferenceStats {

Callers 1

ApplyDecayMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected