Perform batch ANN search using the Client class
(collection, vectors)
| 810 | |
| 811 | |
| 812 | def batch_ann_search(collection, vectors): |
| 813 | """Perform batch ANN search using the Client class""" |
| 814 | try: |
| 815 | # Format the vectors for batch search |
| 816 | queries = [{"vector": vector["dense_values"], "top_k": 5} for vector in vectors] |
| 817 | |
| 818 | # Use the collection's search method |
| 819 | results = collection.search.batch_dense(queries) |
| 820 | return results |
| 821 | except Exception as e: |
| 822 | print(f"Error in batch search: {e}") |
| 823 | raise |
| 824 | |
| 825 | |
| 826 | if __name__ == "__main__": |
nothing calls this directly
no outgoing calls
no test coverage detected