Commit 3c4a037
committed
feat(kmeans): switch from trigger-based to timer-based clustering
- Replace trigger-on-completion with scheduled clustering (default 15min)
- Add KmeansClusterInterval config (ENV: NORNICDB_KMEANS_CLUSTER_INTERVAL)
- Skip clustering cycles if no new embeddings since last run
- Run immediately on startup, then at regular intervals
- Prevents constant re-clustering during active embedding generation
- Configurable via config or environment variable (0 = manual only)
Fixes performance issue where k-means would trigger after every 1-2
embeddings, causing ~1min delays. Now clusters efficiently on schedule
only when changes exist.
Changes:
- pkg/config/config.go: Add KmeansClusterInterval field
- pkg/nornicdb/db.go: Replace SetOnQueueEmpty with timer-based approach
- pkg/cypher/call.go: Add ORDER BY/LIMIT/SKIP support for YIELD
- pkg/cypher/neo4j_compat_test.go: Add node_search/default index tests
- pkg/cypher/yield_return_test.go: Comprehensive YIELD/RETURN tests1 parent 7ad8a99 commit 3c4a037
File tree
5 files changed
+868
-27
lines changed- pkg
- config
- cypher
- nornicdb
5 files changed
+868
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
270 | 273 | | |
271 | 274 | | |
272 | 275 | | |
| |||
1204 | 1207 | | |
1205 | 1208 | | |
1206 | 1209 | | |
| 1210 | + | |
1207 | 1211 | | |
1208 | 1212 | | |
1209 | 1213 | | |
| |||
1464 | 1468 | | |
1465 | 1469 | | |
1466 | 1470 | | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
1467 | 1474 | | |
1468 | 1475 | | |
1469 | 1476 | | |
| |||
0 commit comments