Skip to content

Commit

Permalink
Release new docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Milvus-doc-bot authored and Milvus-doc-bot committed Nov 13, 2024
1 parent a69a9b9 commit 3e7c100
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import random

# Connect to Milvus
connections.connect(
host="10.102.7.3", # Replace with your Milvus server IP
host="127.0.0.1", # Replace with your Milvus server IP
port="19530"
)

Expand Down
18 changes: 10 additions & 8 deletions v2.4.x/site/en/userGuide/search-query-get/single-vector-search.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ The code snippet below repurposes the existing code to establish a connection to
</div>

```python
from pymilvus import MilvusClient
import random

# 1. Set up a Milvus client
client = MilvusClient(
uri=CLUSTER_ENDPOINT,
token=TOKEN
uri="http://localhost:19530"
)

# 2. Create a collection
Expand Down Expand Up @@ -424,7 +426,7 @@ Here is an example of searching for the top 5 entities that are most similar to
```python
# Single vector search
res = client.search(
collection_name="test_collection", # Replace with the actual name of your collection
collection_name="quick_setup", # Replace with the actual name of your collection
# Replace with your query vector
data=[[0.3580376395471989, -0.6023495712049978, 0.18414012509913835, -0.26286205330961354, 0.9029438446296592]],
limit=5, # Max. number of search results to return
Expand Down Expand Up @@ -648,7 +650,7 @@ Here is an example of searching for two distinct sets of the most similar entiti
```python
# Bulk-vector search
res = client.search(
collection_name="test_collection", # Replace with the actual name of your collection
collection_name="quick_setup", # Replace with the actual name of your collection
data=[
[0.19886812562848388, 0.06023560599112088, 0.6976963061752597, 0.2614474506242501, 0.838729485096104],
[0.3172005263489739, 0.9719044792798428, -0.36981146090600725, -0.4860894583077995, 0.95791889146345]
Expand Down Expand Up @@ -1309,7 +1311,7 @@ Here is an example of returning results with `color` attribute values:
```python
# Search with output fields
res = client.search(
collection_name="test_collection", # Replace with the actual name of your collection
collection_name="quick_setup", # Replace with the actual name of your collection
data=[[0.3580376395471989, -0.6023495712049978, 0.18414012509913835, -0.26286205330961354, 0.9029438446296592]],
limit=5, # Max. number of search results to return
search_params={"metric_type": "IP", "params": {}}, # Search parameters
Expand Down Expand Up @@ -1474,7 +1476,7 @@ Filter results whose __color__ is prefixed with __red__:
```python
# Search with filter
res = client.search(
collection_name="test_collection", # Replace with the actual name of your collection
collection_name="quick_setup", # Replace with the actual name of your collection
data=[[0.3580376395471989, -0.6023495712049978, 0.18414012509913835, -0.26286205330961354, 0.9029438446296592]],
limit=5, # Max. number of search results to return
search_params={"metric_type": "IP", "params": {}}, # Search parameters
Expand Down Expand Up @@ -1603,7 +1605,7 @@ Filter results whose __color__ contains the letters __ll__ anywhere within the s
```python
# Infix match on color field
res = client.search(
collection_name="test_collection", # Replace with the actual name of your collection
collection_name="quick_setup", # Replace with the actual name of your collection
data=[[0.3580376395471989, -0.6023495712049978, 0.18414012509913835, -0.26286205330961354, 0.9029438446296592]],
limit=5, # Max. number of search results to return
search_params={"metric_type": "IP", "params": {}}, # Search parameters
Expand Down Expand Up @@ -1714,7 +1716,7 @@ search_params = {
}

res = client.search(
collection_name="test_collection", # Replace with the actual name of your collection
collection_name="quick_setup", # Replace with the actual name of your collection
data=[[0.3580376395471989, -0.6023495712049978, 0.18414012509913835, -0.26286205330961354, 0.9029438446296592]],
limit=3, # Max. number of search results to return
search_params=search_params, # Search parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ To search with an iterator, call the [searchIterator()](https://milvus.io/api-re
</div>

```python
from pymilvus import Collection
from pymilvus import Collection,connections

# 4. Search with iterator
connections.connect(host="127.0.0.1", port=19530)
Expand Down

0 comments on commit 3e7c100

Please sign in to comment.