{"id":10008290,"date":"2023-09-19T19:06:16","date_gmt":"2023-09-19T11:06:16","guid":{"rendered":"https:\/\/blog.itmax.cn\/?p=10008290"},"modified":"2023-09-19T19:06:16","modified_gmt":"2023-09-19T11:06:16","slug":"pymilvus-%e7%9a%84-offset-%e5%8f%82%e6%95%b0%e4%b8%8d%e7%94%9f%e6%95%88","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10008290","title":{"rendered":"pymilvus \u7684 offset \u53c2\u6570\u4e0d\u751f\u6548"},"content":{"rendered":"<p>\u9519\u8bef\u5199\u6cd5<\/p>\n<pre><code class=\"python\">def search_vector(vector: list[float], offset: int = 0, limit: int = 10) -&gt; list[SearchResult]:\n    from pymilvus.orm.search import SearchResult as MilvusSearchResult\n    from loggers import logger\n\n    logger.debug(f'offset: {offset}, limit: {limit}')\n    rows: MilvusSearchResult = collection.search(\n        data=[vector],\n        param={\n            &quot;metric_type&quot;: 'L2',\n            &quot;nprobe&quot;: 32\n        },\n        anns_field='image_vector',\n        output_fields=['id', 'hash_code'],\n        limit=limit,\n        offset=offset\n    )<\/code><\/pre>\n<p>\u6b63\u786e\u7684\u5199\u6cd5<\/p>\n<pre><code class=\"python\">def search_vector(vector: list[float], offset: int = 0, limit: int = 10) -&gt; list[SearchResult]:\n    from pymilvus.orm.search import SearchResult as MilvusSearchResult\n    from loggers import logger\n\n    logger.debug(f'offset: {offset}, limit: {limit}')\n    rows: MilvusSearchResult = collection.search(\n        data=[vector],\n        param={\n            &quot;metric_type&quot;: 'L2',\n            &quot;nprobe&quot;: 32,\n            &quot;offset&quot;: offset\n        },\n        anns_field='image_vector',\n        output_fields=['id', 'hash_code'],\n        limit=limit,\n        # offset=offset\n    )<\/code><\/pre>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000044230895\">https:\/\/segmentfault.com\/a\/1190000044230895<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9519\u8bef\u5199\u6cd5 def search_vector(vector: list[float], offset: int [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10008290","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008290","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10008290"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008290\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10008290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10008290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10008290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}