Zvec Logo

获取 Document

使用 fetch()id 获取 Document。 这是一个直接查找操作——不涉及搜索、评分或过滤。

获取 Document
# 获取单个 Document
result = collection.fetch(ids="book_1")
print(result)   # { "book_1": Doc(...) }


# 获取多个 Document
result = collection.fetch(ids=["book_1", "book_2", "book_3"])
print(result)   # { "book_1": Doc(...), "book_2": Doc(...), "book_3": Doc(...) }
  • 输入:单个 Document idid 列表。
  • 输出:从每个找到的 id 到对应 Document 对象的映射。
  • 不存在的 id 会被静默忽略(不会抛出错误)。
  • 返回的字典不保证输入顺序——请通过 id 访问 Document。