Giter Club home page Giter Club logo

Comments (8)

sudheesh001 avatar sudheesh001 commented on August 20, 2024 2

Documentation pending in loklak_server. Changes need to roll out for pagination support in all the SDK Wrappers on Python, Ruby, PHP and Go

from loklak_search.

pranayyelugam avatar pranayyelugam commented on August 20, 2024

@mariobehling I'd like take up this.
Is the feed count limited to only 10 per a query string?

from loklak_search.

hemantjadon avatar hemantjadon commented on August 20, 2024

@pranayyelugam
I wrote This 10 query per page limit. It can be adjusted, in src/app/shared/services/search/search.service.ts.
I put up that limit to ensure fast loading of results

Can you please share the approach which you will take for making this ??

@mariobehling
Is there any backend pagination available in loklak server?

from loklak_search.

mariobehling avatar mariobehling commented on August 20, 2024

Is there any backend pagination available in loklak server?

Not yet.

@Orbiter Is that something we want in the server?

from loklak_search.

Orbiter avatar Orbiter commented on August 20, 2024

pagination is now implemented, for query parameters the SRU 2.0 standard was implemented.
See loklak/loklak_server@92f8fe3

I.e.:
first page:
http://loklak.org/api/search.json?timezoneOffset=-60&q=singapore&startRecord=1&maximumRecords=10
second page:
http://loklak.org/api/search.json?timezoneOffset=-60&q=singapore&startRecord=10&maximumRecords=10

from loklak_search.

hemantjadon avatar hemantjadon commented on August 20, 2024

Hi,
I am thinking of ways to implement this. Practically there are two solutions possible.

  • Infinite Scroll List (Auto loading / load more on click button)

  • Basic Paginiation With page buttons.

There are Pros and cons of both the approaches.

Infinite Scroll list

  • Pros :

    • Easy to implement in current situation with ngrx/store

    • Easy filtering implementation once (video/images/news etc) filters are implemented as we will just have one continuous data source. (One array of responses)

    • Thus will be helpful and easier to implement initially.

  • Cons :

    • When we implement the infinite scroll type once the no of elements become too high it leads to performance bottlenecks as browser is unable to render such high no of components. Now the threshold for this will be approximately when we have 300-400 components (On slower devices taking the worst case).
  • Workarounds

    • Now there is workaround of this using something called lazy rendering ie. we only render the components which are just in the viewport (7-10) and reuse these components on scrolling with different datas. This may seem mayhem at first but there is a fantastic implementation in PolymerElements <iron-list>. Unfortunately something like that is not available in the angular right now. Own implementation may take time and can be buggy.

Basic pagination with buttons

  • Pros :

    • Simpler to reduce the scroll jank as at max only 20-30 components will be in viewport.

    • Easier to control the page navigation.

  • Cons :

    • Tougher to implement and maintain the state.

    • As now we have to think in terms of pages instead of all the results.

    • These pages will be even tougher to implement once we include filtering in the scenario, as now we have to calculate the filter across all the results and then we can't again split them up in pages.

    • Consider the situation, we have 3 pages with each containing 30 results (with only 10 results containing videos), now when we filter with videos we have nothing to show on the page 2 and 3 and they will be blank (not good situation to handle). Google has entirely different results page to show on the filtering, ie Google Images Google Videos Google News. Which is now the case in our situation as we have to filter only the current results.

    • Also the number of results coming from the API is not fixed, ie first page contains 20 results, and then when next page is clicked there are no results, and when again next page click we may receive 10 more results, which means (first page -> 20 responses, second page -> No result, third page -> 10 responses). Again not a good situation to handle.

@mariobehling your views on this. All inputs are required.

from loklak_search.

mariobehling avatar mariobehling commented on August 20, 2024

@hemantjadon Thanks for this sum up from your side. Lazy rendering sounds like a good thing then. Please go ahead and implement it. Cheers.

from loklak_search.

hemantjadon avatar hemantjadon commented on August 20, 2024

@mariobehling Is the current implementation using Show More button good?
Also please tell what to do if the there are no results come via the api.
Which happens many time, sometimes the results come up clicking Show More 5-10 times.

from loklak_search.

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.