Performs hybrid search combining semantic and text search with RRF.
Hybrid search runs both semantic search (with auto-generated embeddings) and text search (keyword matching) in parallel, then combines results using Reciprocal Rank Fusion (RRF) algorithm for optimal ranking.
hybrid_search(
project_id: str,
region: str,
collection_id: str,
search_text: str,
search_field: str,
data_field_names: List[str],
num_neighbors: int,
task_type: str = 'RETRIEVAL_QUERY',
filter_: dict | None = None,
semantic_weight: float = 1.0,
text_weight: float = 1.0,
credentials: Optional[Credentials] = None
) -> List[dict[str, Any]]| Name | Type | Description |
|---|---|---|
project_id* | str | The GCP project ID. |
region* | str | The GCP region. |
collection_id* | str | The collection ID. |
search_text* | str | Query text used for both semantic and text search. |
search_field* | str | Name of the vector field to search (must have auto-embedding config). |
data_field_names* | List[str] | List of data field names to search in for text search. |
num_neighbors* | int | Number of neighbors to return from each search before fusion. |
task_type | str | Default: 'RETRIEVAL_QUERY'Embedding task type for semantic search. Options: "RETRIEVAL_QUERY", "RETRIEVAL_DOCUMENT", etc. |
filter_ | dict | None | Default: NoneOptional filter dict for semantic search only. Example: {"category": {"$eq": "Dresses"}} |
semantic_weight | float | Default: 1.0Weight for semantic search results in RRF (0.0 to 1.0+). |
text_weight | float | Default: 1.0Weight for text search results in RRF (0.0 to 1.0+). |
credentials | Optional[Credentials] | Default: NoneOptional credentials to use. |