28 lines
1.9 KiB
Python
28 lines
1.9 KiB
Python
import json
|
|
import time
|
|
|
|
from pymilvus import MilvusClient
|
|
|
|
client = MilvusClient(
|
|
uri="http://10.1.1.240:19530",
|
|
token="root:Milvus",
|
|
db_name="mixi"
|
|
)
|
|
data = [0.019687360152602196, 0.839404821395874, 0.5053166747093201, 0.6062483787536621, 0.5455009341239929, 0.07595491409301758, 0.028354600071907043, 0.24453534185886383, 0.6116685271263123, 0.4527449309825897, 0.22063420712947845, 0.09205381572246552, 0.22853578627109528, 0.3041312098503113,
|
|
0.8354143500328064, 0.05135197564959526, 0.9292615652084351, 0.03914223983883858, 0.7091595530509949, 0.17939062416553497, 0.2958671748638153, 0.46751415729522705, 0.05523946136236191, 0.976833164691925, 0.3593502938747406, 0.0806853398680687, 0.3097323179244995, 0.12855321168899536,
|
|
0.12651172280311584, 0.3173355162143707, 0.17060844600200653, 0.9340737462043762, 0.8437095880508423, 0.7500482797622681, 0.22598184645175934, 0.8127533197402954, 0.39825528860092163, 0.9043431878089905, 0.9064653515815735, 0.14613617956638336, 0.582768976688385, 0.4516744315624237,
|
|
0.6479957699775696, 0.909612774848938, 0.7674093842506409, 0.47747865319252014, 0.5617552995681763, 0.967750072479248, 0.9146659970283508, 0.28031912446022034, 0.5092940330505371, 0.21442186832427979, 0.43696293234825134, 0.7705745100975037, 0.09395607560873032, 0.9103220701217651,
|
|
0.2616001069545746, 0.7469480037689209, 0.24508604407310486, 0.6890515089035034, 0.704613447189331, 0.7213652729988098, 0.3660031855106354, 0.2150406688451767]
|
|
start_time = time.time()
|
|
res = client.search(
|
|
collection_name="mixi_outfit", # Replace with the actual name of your collection
|
|
# Replace with your query vector
|
|
data=[data],
|
|
limit=5, # Max. number of search results to return
|
|
# search_params={"metric_type": "IP", "params": {}} # Search parameters
|
|
)
|
|
print(time.time() - start_time)
|
|
|
|
result = json.dumps(res, indent=4)
|
|
print(result)
|