Coder Social home page Coder Social logo

Comments (3)

sirosen avatar sirosen commented on May 25, 2024 1

Sorry about the delayed response here. I missed your initial issue coming in and am just reading this now.

I think one less hacky feeling approach would be to make the paginated call to get the paginator and then modify the limit parameter which it is using.
That is

paginator = sc.paginated.post_search(index_id, query_data)
paginator.limit = 300
for response in paginator:
    ...

I'm currently looking at the limit+offset pagination code to see if there are issues with this suggestion, and I believe it will work safely.
For now, that is what I would recommend for this customization.


More broadly, what you're asking about is how to control pagination parameters (rather than the parameters to the paginated call).

I need to think harder about what a good interface looks like. It might be that we need to recognize parameters which are valid for both purposes (like limit) and "lift" them into the paginator if appropriate, such that a paginated search with limit=300 "just works". But this model needs to work consistently for other pagination modes in order for us to confidently offer that as our interface.

For now, I think building a paginator and then adjusting its attributes is the best way. There are other possibilities for the future, but we'll need to do some analysis to figure out what's best for all cases.

EDIT: sorry, there was a typo in the original code sample I shared.

from globus-sdk-python.

nocollier avatar nocollier commented on May 25, 2024 1

That feels much better, many thanks.

from globus-sdk-python.

nocollier avatar nocollier commented on May 25, 2024

I have looked into this further and it seems to me that the limit keyword is not used in the paginated version of the method. If you look at this line you see that the post_search method has the paginated decorator where the page_size=100. This is used when the client is instantiated to build paginated versions of any routine with this decorator. However your page size is fixed. If I add:

sc.paginated.post_search._paginator_params['page_size'] = 300

just above my post_search then I get the expected pagination. But this is more of a hack, is there a more canonical method of selecting page size in paginated calls?

from globus-sdk-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.