MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / create_and_lookup

Function create_and_lookup

nodedb/src/engine/sparse/gsi.rs:343–358  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

341
342 #[test]
343 fn create_and_lookup() {
344 let (store, _dir) = open_store();
345 store
346 .create_index(1, "users", "email_idx", "email", vec![])
347 .unwrap();
348
349 let doc = serde_json::json!({"email": "alice@example.com", "name": "Alice"});
350 let indexes = store.list_indexes(1, "users").unwrap();
351 store
352 .index_document(1, "users", "u1", 0, &doc, &indexes)
353 .unwrap();
354
355 let results = store.lookup("email_idx", "alice@example.com").unwrap();
356 assert_eq!(results.len(), 1);
357 assert_eq!(results[0].document_id, "u1");
358 }
359
360 #[test]
361 fn max_gsi_limit() {

Callers

nothing calls this directly

Calls 5

create_indexMethod · 0.80
list_indexesMethod · 0.80
open_storeFunction · 0.70
index_documentMethod · 0.45
lookupMethod · 0.45

Tested by

no test coverage detected