Skip to content

Conversation

dwdougherty
Copy link
Collaborator

@dwdougherty dwdougherty commented Oct 3, 2025

@adrianoamaral: I've posted this PR as a draft, as I think we might need to iterate on it a bit. We'll see.

@dwdougherty dwdougherty self-assigned this Oct 3, 2025
@dwdougherty dwdougherty added dev ros 8.4 Redis Open Source release 8.4 labels Oct 3, 2025
Copy link
Contributor

github-actions bot commented Oct 3, 2025

DOC-5800

@dwdougherty dwdougherty marked this pull request as draft October 3, 2025 17:32
Copy link
Contributor

@adrianoamaral adrianoamaral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just few adjustments in regards Query Attributes in general.


You can reference parameters in the `query` by a `$`, followed by the parameter name, for example, `$user`. Each such reference in the search query to a parameter name is substituted by the corresponding parameter value. For example, with parameter definition `PARAMS 4 lon 29.69465 lat 34.95126`, the expression `@loc:[$lon $lat 10 km]` is evaluated to `@loc:[29.69465 34.95126 10 km]`. You cannot reference parameters in the query string where concrete values are not allowed, such as in field names, for example, `@loc`. To use `PARAMS`, set `DIALECT` to `2` or greater than `2`.

**Query attributes**: You can also use `PARAMS` to pass values to [query attributes]({{< relref "/develop/ai/search-and-query/advanced-concepts/query_syntax#query-attributes" >}}) in vector search queries. For example, `$SHARD_K_RATIO` controls cluster optimization for vector KNN queries by setting the ratio of results each shard retrieves relative to the requested `top_k`. See [cluster-specific query parameters]({{< relref "develop/ai/search-and-query/vectors#cluster-specific-query-parameters" >}}) for details.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should link PARAMS with Query Attributes. I would frame it more like: "ability to adjust in the query time, how the query behave and flexibly adjust the query to your use case". Likewise, I believe we should move this section: https://redis.io/docs/latest/develop/ai/search-and-query/advanced-concepts/query_syntax/#query-attributes to a specific page.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adrianoamaral: I don't understand your comment. If you don't use the PARAMS option to pass $shard_k_ratio, then how is one supposed to use it?

[`DIALECT`]({{< relref "/develop/ai/search-and-query/advanced-concepts/dialects#dialect-2" >}})
to `2` or greater than `2` (this requires [RediSearch v2.4](https://github.com/RediSearch/RediSearch/releases/tag/v2.4.3) or above).

**Query attributes**: You can also use `PARAMS` to pass values to [query attributes]({{< relref "/develop/ai/search-and-query/advanced-concepts/query_syntax#query-attributes" >}}) in vector search queries. For example, `$SHARD_K_RATIO` controls cluster optimization for vector KNN queries by setting the ratio of results each shard retrieves relative to the requested `top_k`. See [cluster-specific query parameters]({{< relref "develop/ai/search-and-query/vectors#cluster-specific-query-parameters" >}}) for details.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should link PARAMS with Query Attributes. I would frame it more like: "ability to adjust in the query time, how the query behave and flexibly adjust the query to your use case". Likewise, I believe we should move this section: https://redis.io/docs/latest/develop/ai/search-and-query/advanced-concepts/query_syntax/#query-attributes to a specific page.

As of v2.6.1, the query attributes syntax supports these additional attributes:

* **$yield_distance_as**: specifies the distance field name, used for later sorting and/or returning, for clauses that yield some distance metric. It is currently supported for vector queries only (both KNN and range).
* **$yield_distance_as**: specifies the distance field name, used for later sorting and/or returning, for clauses that yield some distance metric. It is currently supported for vector queries only (both KNN and range).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above, I believe we should move this entire section to a new page.

@dwdougherty dwdougherty marked this pull request as ready for review October 14, 2025 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev ros 8.4 Redis Open Source release 8.4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants