POST /compose/bundle_search/{db_name}/{namespace}¶
Searches using a bundled prototype vector created from multiple values. Returns rows similar to any of the provided values in a single query — a capability unique to HDC that would otherwise require multiple separate searches.
Request¶
Content-Type: application/json
URL Parameters:
| Parameter | Description |
|---|---|
db_name |
Name of the database |
namespace |
Namespace within the database |
Body:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
values |
list of string | ✅ | — | Values to bundle into a prototype query vector |
field_name |
string | ❌ | "value" |
Field to search against |
encoding |
string | ❌ | null |
Encoding type: "semantic", "exact", or "numeric". Auto-detected from schema if omitted |
top_k |
int | ❌ | 10 |
Number of results to return |
schema_json_data |
string | ❌ | null |
JSON string of the schema. Used for encoding detection if not stored in metadata |
Behavior¶
All provided values are encoded and bundled (superimposed) into a single prototype hypervector. The search then finds rows most similar to that prototype — effectively matching rows that are similar to any of the input values simultaneously.
If encoding is "semantic", embeddings for all values are loaded into the cache before the Rust search call, enabling neural similarity matching.
Responses¶
200 OK¶
{
"status": "success",
"query_type": "bundle_search",
"values": ["Alice", "Bob", "Carol"],
"count": 3,
"results": [
{
"_id": 0,
"_score": 0.923,
"data": {
"name": "Alice",
"department": "Engineering"
}
},
{
"_id": 5,
"_score": 0.871,
"data": {
"name": "Bob",
"department": "Finance"
}
}
]
}
| Field | Description |
|---|---|
values |
The input values that were bundled |
count |
Number of results returned |
results |
Array of matches, each with _id, _score, and data fields |
Error Responses¶
| Status | Condition |
|---|---|
400 |
No values provided |
404 |
Collection not found |
500 |
Unexpected internal error |
Notes¶
- Bundle search is equivalent to an OR query but operates in a single vector operation — no repeated queries needed.
- The more values bundled, the more diffuse the prototype becomes. For highly specific searches, prefer
/compose/search_slotwith a single query. - If
encodingandschema_json_dataare both omitted and no schema is stored in metadata, encoding defaults to"semantic".
Example¶
import requests
SERVER_URL = "http://18.220.128.24:8000"
API_KEY = "yourapitoken"
def bundle_search(db_name: str, namespace: str, values: list, field_name: str = "value", top_k: int = 10) -> dict:
response = requests.post(
f"{SERVER_URL}/compose/bundle_search/{db_name}/{namespace}",
headers={"X-API-Key": API_KEY},
json={
"values": values,
"field_name": field_name,
"top_k": top_k,
},
)
response.raise_for_status()
return response.json()
result = bundle_search(
db_name="my_db",
namespace="default",
values=["Alice", "Bob", "Carol"],
field_name="name",
top_k=5,
)
print(result)
Expected output:
{
"status": "success",
"query_type": "bundle_search",
"values": ["Alice", "Bob", "Carol"],
"count": 3,
"results": [
{ "_id": 0, "_score": 0.923, "data": { "name": "Alice", "department": "Engineering" } },
{ "_id": 5, "_score": 0.871, "data": { "name": "Bob", "department": "Finance" } },
{ "_id": 9, "_score": 0.844, "data": { "name": "Carol", "department": "Legal" } }
]
}