AlloyDBKeywordRetriever
Retrieve documents from an AlloyDBDocumentStore using full-text keyword search. Use this component in query pipelines when you need BM25-style text matching rather than vector similarity search.
Key Features
- Performs full-text search using AlloyDB's native keyword indexing.
- Configurable filter policy to merge or replace filters at query time.
- Can be combined with
AlloyDBEmbeddingRetrieverin a hybrid search pipeline.
Configuration
Add Workspace-Level Integration
- Click your profile icon and choose Settings.
- Go to Workspace>Integrations.
- Find the provider you want to connect and click Connect next to them.
- Enter the API key and any other required details.
- Click Connect. You can use this integration in pipelines and indexes in the current workspace.
Add Organization-Level Integration
- Click your profile icon and choose Settings.
- Go to Organization>Integrations.
- Find the provider you want to connect and click Connect next to them.
- Enter the API key and any other required details.
- Click Connect. You can use this integration in pipelines and indexes in all workspaces in the current organization.
- First, configure an
AlloyDBDocumentStorein your pipeline. - Drag the
AlloyDBKeywordRetrievercomponent onto the canvas from the Component Library. - Connect the component to a query input and downstream components such as
PromptBuilder.
Connections
AlloyDBKeywordRetriever receives a text query string as input. It outputs a list of Document objects you can connect to PromptBuilder or other downstream components.
Source Code
To check this component's source code, open keyword_retriever.py in the Haystack Core Integrations repository.
Usage Examples
Basic Configuration
AlloyDBKeywordRetriever:
type: haystack_integrations.components.retrievers.alloydb.keyword_retriever.AlloyDBKeywordRetriever
init_parameters:
document_store: AlloyDBDocumentStore
top_k: 5
Parameters
Inputs
| Parameter | Type | Description |
|---|---|---|
query | str | The text query to search for. |
filters | Optional[Dict[str, Any]] | Filters to apply when retrieving documents. |
top_k | Optional[int] | The maximum number of documents to retrieve. Overrides the init-time value. |
Outputs
| Parameter | Type | Description |
|---|---|---|
documents | List[Document] | A list of matching documents from the document store. |
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
document_store | AlloyDBDocumentStore | The AlloyDB document store to retrieve documents from. | |
filters | Optional[Dict[str, Any]] | None | Default filters to apply when retrieving documents. |
top_k | int | 10 | The maximum number of documents to retrieve. |
filter_policy | FilterPolicy | FilterPolicy.REPLACE | How to handle filters passed at query time. REPLACE replaces init-time filters; MERGE combines them. |
Run Method Parameters
These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.
| Parameter | Type | Default | Description |
|---|---|---|---|
query | str | The text query to search for. | |
filters | Optional[Dict[str, Any]] | None | Runtime filters to apply. |
top_k | Optional[int] | None | Maximum number of documents to retrieve. Overrides the init-time value. |
Related Information
Was this page helpful?