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

Method bind_dql_methods

src/binding/python/model/python_collection.cc:252–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252void ZVecPyCollection::bind_dql_methods(
253 py::class_<Collection, Collection::Ptr> &col) {
254 col.def("Query",
255 [](const Collection &self, const SearchQuery &query) {
256 Result<DocPtrList> result;
257 {
258 py::gil_scoped_release release;
259 result = self.Query(query);
260 }
261 // return DocPtrList
262 return unwrap_expected(result);
263 })
264 // MultiQuery: multi query with reranker
265 .def(
266 "Query",
267 [](const Collection &self, const MultiQuery &query) {
268 Result<DocPtrList> result;
269 {
270 py::gil_scoped_release release;
271 result = self.Query(query);
272 }
273 // return DocPtrList
274 return unwrap_expected(result);
275 },
276 py::arg("query"), "Execute a multi query with re-ranking.")
277 .def("GroupByQuery",
278 [](const Collection &self, const GroupByVectorQuery &query) {
279 Result<GroupResults> result;
280 {
281 py::gil_scoped_release release;
282 result = self.GroupByQuery(query);
283 }
284 // return GroupResults
285 return unwrap_expected(result);
286 })
287 .def(
288 "Fetch",
289 [](const Collection &self, const std::vector<std::string> &pks,
290 const std::optional<std::vector<std::string>> &output_fields,
291 bool include_vector) {
292 Result<DocPtrMap> result;
293 {
294 py::gil_scoped_release release;
295 result = self.Fetch(pks, output_fields, include_vector);
296 }
297 // return DocPtrMap
298 return unwrap_expected(result);
299 },
300 py::arg("pks"), py::arg("output_fields") = py::none(),
301 py::arg("include_vector") = true)
302 .def(
303 "_debug_hnsw_storage_mode",
304 [](const Collection &self, const std::string &column_name) {
305 const auto result = self.DebugGetHnswStorageMode(column_name);
306 return unwrap_expected(result);
307 },
308 py::arg("column_name"),
309 "Debug-only: returns the storage mode of the HNSW entity on the "

Callers

nothing calls this directly

Calls 5

unwrap_expectedFunction · 0.85
QueryMethod · 0.80
GroupByQueryMethod · 0.80
FetchMethod · 0.45

Tested by

no test coverage detected