Skip to content

Cosmos/FullTextSearch: ORDER BY RANK requires OFFSET/LIMIT to be constants, which clashes with EF parameterizing those #35867

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
maumar opened this issue Mar 29, 2025 · 2 comments · Fixed by #35868

Comments

@maumar
Copy link
Contributor

maumar commented Mar 29, 2025

When using ORDER BY RANK with FullTextScore or RRF functions, and also applying Skip/Take we get error:

Invalid OFFSET/LIMIT spec for Hybrid Search query. Expected a number literal in order to distribute query correctly.

What EF generates by default is a parameter for Skip/Take. This happens in funcletizer, which is in Core and also way to early for us to know if we are dealing with full text search ordering.

@maumar
Copy link
Contributor Author

maumar commented Mar 29, 2025

/cc @roji

@roji
Copy link
Member

roji commented Mar 29, 2025

We should be able to inline the parameter like we do in other contexts, e.g. Contains over parameterzed list in relational, no?

maumar added a commit that referenced this issue Mar 31, 2025
outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked)
- support for Owned types (adjust model in tests and fix paths) - this also needs to happen for vector search
- add model building support for default language,
- add more tests for hybrid search,
- add more model validation tests for invalid scenarios (index on multiple columns, FTS on non-string etc)
- add xml docs,
- clean up exception messages and put them in a resource file,

Fixes #35476
Fixes #35853
Fixes #35867
maumar added a commit that referenced this issue Mar 31, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked)
- support for Owned types (adjust model in tests and fix paths) - this also needs to happen for vector search
- add model building support for default language,
- add more tests for hybrid search,
- add more model validation tests for invalid scenarios (index on multiple columns, FTS on non-string etc)
- add xml docs,
- clean up exception messages and put them in a resource file,

Fixes #35476
Fixes #35853
Fixes #35867
maumar added a commit that referenced this issue Apr 1, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked)
- support for Owned types (adjust model in tests and fix paths) - this also needs to happen for vector search
- add model building support for default language,
- add more tests for hybrid search,
- add more model validation tests for invalid scenarios (index on multiple columns, FTS on non-string etc)
- add xml docs,
- clean up exception messages and put them in a resource file,

Fixes #35476
Fixes #35853
Fixes #35867
maumar added a commit that referenced this issue Apr 1, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),

- add more model validation tests for invalid scenarios (index on multiple columns, FTS on non-string etc)
- clean up exception messages and put them in a resource file,

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 1, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),

- add more model validation tests for invalid scenarios (index on multiple columns, FTS on non-string etc)
- clean up exception messages and put them in a resource file,

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 2, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),
- add more model validation tests for invalid scenarios (index on multiple columns, FTS on non-string etc)
- clean up exception messages and put them in a resource file,

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 2, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),
- add more model validation tests for invalid scenarios (index on multiple columns, FTS on non-string etc)
- clean up exception messages and put them in a resource file,

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 2, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),
- clean up exception messages and put them in a resource file,

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 2, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),
- clean up exception messages and put them in a resource file,

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
@maumar maumar added this to the 10.0.0 milestone Apr 2, 2025
@maumar maumar self-assigned this Apr 2, 2025
maumar added a commit that referenced this issue Apr 3, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),
- clean up exception messages and put them in a resource file,

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 3, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 3, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 3, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 5, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 5, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 9, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 12, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 14, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)
- add model building support for default language (superfluous for now, since only one language is supported),

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 15, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.
- Adding model building support for default language on the container level

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
maumar added a commit that referenced this issue Apr 15, 2025
- Adding model building API to configure property as full-text search enabled, as well as setup the index for it,
- Adding model validation (e.g. FTS index not matching FTS property),
- Adding EF.Functions stubs and translations for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF (for hybrid),
- Adding logic in SelectExpression to produce ORDER BY RANK when necessary,
- Adding validation when attempting to mix with ORDER BY RANK with regular ORDER BY,
- Rewrite OFFSET/LIMIT from parameter to constant when ORDER BY RANK is present.
- Adding model building support for default language on the container level

Also fixed / added support for vector search on owned types (since it shares logic with FTS) and added some tests.

outstanding work:
- support for FTS Container building using Azure.ResourceManager.CosmosDb (currently blocked on updated package being released)

Fixes #35476
Fixes #35853
Fixes #35867
Fixes #35852
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants