Query Collection Block

Perform searches on Scout collections with customizable filters

The Query Collection block enables users to perform searches on specified Scout collections by utilizing customizable filters. It supports dynamic query construction using Jinja templating, enabling precise and efficient data retrieval from collections.

Configuration (Required)

Collection
stringRequired

The ID of the collection to query. Ensure the collection ID is correct and exists to avoid errors during execution.

limit
integer

Specifies the maximum number of documents to retrieve from the collection. The default value is 10. Adjust this setting based on the specific needs of your task or application.

minimum_similarity
float

Determines the threshold for document similarity in the retrieval process. A value closer to 1 requires a higher similarity between the query and the document text, while a value closer to 0 allows for more lenient matches. The default value is 0.5.

Filter Collection
list

Filters to apply to the collections metadata. Use appropriate filters to narrow down search results and retrieve precise data.

Query
codeRequired

The query to search for in the collection. This input supports Jinja templating, allowing for dynamic query construction based on workflow state.

See Workflow Logic & State > State Management for details on using dynamic variables in this block.

Outputs

The block outputs a list of results from the collection query, including similarity scores, text, and metadata. This structured output allows for further processing and integration within the workflow.

Usage Context

Use this block to search through Scout collections using specified criteria and filters. It is ideal for retrieving data based on dynamic queries and conditions.

Best Practices

  • Ensure the collection ID corresponds to an existing collection. This prevents errors and ensures that the query is executed on the correct dataset.
  • Utilize Jinja templating in the query field for dynamic search criteria. This allows for flexible and adaptable query construction based on the workflow state.
  • Set appropriate limits and similarity thresholds to optimize search results. Adjust these parameters to balance between result quantity and relevance.
  • Define clear and precise filters to narrow down search results effectively. This helps in retrieving the most relevant data from the collection.