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

Method is_covering

nodedb/src/engine/sparse/gsi.rs:318–328  ·  view source on GitHub ↗

Check if a GSI covers all projected columns (covering index query). A covering index includes the indexed field + all payload_fields. If the query projection is a subset, we can serve the query from the GSI without a primary document fetch.

(meta: &GsiMeta, projection: &[String])

Source from the content-addressed store, hash-verified

316 /// If the query projection is a subset, we can serve the query from
317 /// the GSI without a primary document fetch.
318 pub fn is_covering(meta: &GsiMeta, projection: &[String]) -> bool {
319 if projection.is_empty() {
320 return false; // SELECT * always needs primary.
321 }
322 projection.iter().all(|col| {
323 col == &meta.field
324 || col == "id"
325 || col == "document_id"
326 || meta.payload_fields.contains(col)
327 })
328 }
329}
330
331#[cfg(test)]

Callers

nothing calls this directly

Calls 4

is_emptyMethod · 0.45
allMethod · 0.45
iterMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected