fix E4.3: 回退 FileGraph,恢复 SQLiteGraphStore(数据在 graph.db)
切换 FileGraph 导致 9.9MB 历史图谱数据丢失。 恢复 NewSQLiteGraphStore,GetEntityDegree 加到 SQLiteGraphStore。 验证:1720 节点,32983 边。
This commit is contained in:
parent
2d0923a85c
commit
525b5f2bb2
|
|
@ -99,13 +99,13 @@ func NewServer() http.Handler {
|
|||
graphPath = "/var/lib/memoryweave/graph.db"
|
||||
}
|
||||
var graphStore governance.GraphStore
|
||||
gs, err := governance.NewFileGraph(graphPath)
|
||||
gs, err := governance.NewSQLiteGraphStore(graphPath)
|
||||
if err != nil {
|
||||
log.Printf("[zhiyid] WARN: FileGraph 初始化失败 (%v),降级为 InMemoryGraph", err)
|
||||
log.Printf("[zhiyid] WARN: SQLite 图谱初始化失败 (%v),降级为 InMemoryGraph", err)
|
||||
graphStore = governance.NewInMemoryGraph()
|
||||
} else {
|
||||
graphStore = gs
|
||||
log.Printf("[zhiyid] 图谱后端: FileGraph — %s", graphPath)
|
||||
log.Printf("[zhiyid] 图谱后端: SQLiteGraphStore — %s", graphPath)
|
||||
}
|
||||
graphUpdater := governance.NewAutoGraphUpdater(graphStore)
|
||||
graphAPI := routes.NewGraphAPI(graphStore)
|
||||
|
|
|
|||
|
|
@ -818,6 +818,11 @@ func (gs *SQLiteGraphStore) EvidenceCount(entity string) int {
|
|||
return sum
|
||||
}
|
||||
|
||||
// GetEntityDegree E4.3: 返回实体的图谱度(入度+出度),度越高越优先保留
|
||||
func (gs *SQLiteGraphStore) GetEntityDegree(entity string) int {
|
||||
return gs.EvidenceCount(entity)
|
||||
}
|
||||
|
||||
// ─── CGO 工具 ──────────────────────────────────────────
|
||||
|
||||
// UpdatePageRanks 批量更新节点的 pagerank 值(§2.5.5)
|
||||
|
|
|
|||
Loading…
Reference in New Issue