azure-sdk-for-java: [BUG] Cosmos Pagination Example

Describe the bug Looking for examples on dynamic query generation while still supporting proper pagination. Unfortunately this is not straightforward with the methods exposed by the SDK because of code snippets like this

if (query.getLimit() > 0) {
            queryString = new StringBuilder(queryString)
                .append(" OFFSET 0 LIMIT ")
                .append(query.getLimit()).toString();
}

from here: AbstractQueryGenerator.java

Expected behavior An example exists that shows how you could expose a method that would be able to take multiple fields. For example if you were allowed to expose a method that accepted a list of com.azure.spring.data.cosmos.core.query.Criteria and utilized that to build a dynamic query for Cosmos while still respecting proper pagination which has to be implemented via offset and limits given Cosmos limitations.

@kushagraThapar - New issue per request here https://github.com/Azure/azure-sdk-for-java/issues/17927#issuecomment-1087677973

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (9 by maintainers)

Most upvoted comments

Makes sense. Appreciate all the hard work on this @trande4884 . Once this rolls out, we’ll take a look and hopefully be able to replace our custom code with the standard SDK calls.

No worries, we already started working on a solution, please see the above PR by @trande4884