query: add created/timestamp sort fields

Make 'created' resolve to created_at epoch (numeric, sortable) and add
'timestamp' field. Enables `sort created desc` and `sort created asc`
in query pipelines.

Example: poc-memory query "key ~ 'bcachefs' | sort created desc | limit 10"

Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
ProofOfConcept 2026-03-14 17:09:27 -04:00
parent 83342897c8
commit 502bf5410c

View file

@ -180,7 +180,8 @@ fn resolve_field(field: &str, key: &str, store: &Store, graph: &Graph) -> Option
"retrievals" => Some(Value::Num(node.retrievals as f64)), "retrievals" => Some(Value::Num(node.retrievals as f64)),
"uses" => Some(Value::Num(node.uses as f64)), "uses" => Some(Value::Num(node.uses as f64)),
"wrongs" => Some(Value::Num(node.wrongs as f64)), "wrongs" => Some(Value::Num(node.wrongs as f64)),
"created" => Some(Value::Str(node.created.clone())), "created" => Some(Value::Num(node.created_at as f64)),
"timestamp" => Some(Value::Num(node.timestamp as f64)),
"content" => Some(Value::Str(node.content.clone())), "content" => Some(Value::Str(node.content.clone())),
"degree" => Some(Value::Num(graph.degree(key) as f64)), "degree" => Some(Value::Num(graph.degree(key) as f64)),
"community_id" => { "community_id" => {