MCPcopy Create free account
hub / github.com/alibaba/zvec / bind_collection_stats

Method bind_collection_stats

src/binding/python/model/schema/python_schema.cc:140–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140void ZVecPySchemas::bind_collection_stats(py::module_ &m) {
141 pybind11::class_<CollectionStats>(m, "CollectionStats")
142 .def(pybind11::init<>())
143 .def_property_readonly(
144 "doc_count", [](const CollectionStats &c) { return c.doc_count; })
145 .def_property_readonly(
146 "index_completeness",
147 [](const CollectionStats &c) { return c.index_completeness; })
148 .def("__repr__", [](const CollectionStats &c) {
149 std::string map_str = "{";
150 bool first = true;
151 for (const auto &[k, v] : c.index_completeness) {
152 if (!first) map_str += ", ";
153 map_str += "\"" + k + "\":" + std::to_string(v);
154 first = false;
155 }
156 map_str += "}";
157 return "{\"doc_count\":" + std::to_string(c.doc_count) +
158 ", \"index_completeness\":" + map_str + "}";
159 });
160}
161
162} // namespace zvec

Callers

nothing calls this directly

Calls 1

to_stringFunction · 0.50

Tested by

no test coverage detected