-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support paging in cache. #14
base: master
Are you sure you want to change the base?
Conversation
…ded for a query and merge subsequent data payloads in history
I set up an example app to showcase paginated searching while also demoing how to use masonry layout manager properly in meteor and how to implement an infinite scroll: |
Wow. That's awesome. I'd love to get this PR. |
I have a simple way to handle this optional data and caching them. What do you think? |
That's what I did first, have separate cache keys for every different request [query, skip, limit]. I mean, when you do subsequent requests (with the same query) like this [0,20], [5,10], [10,15], [15,20] only the first request should miss cache. I still have to add logic to make sure the [skip, limit] options are modified with respect to what is already in cache. When you do subsequent requests like this [0,10] [5,15] [10,25], this should be modified to [0,10] [10,15] [15,25] |
May be we can do something like this. We can use a global store for caching actual docs with the number of times Will that going to save the issue? On Sun, Apr 5, 2015 at 12:50 PM Pieter Soudan [email protected]
|
Yes, then we only store the docs once, but we still make too much requests on the backend... |
Coming to think of it, I still have to add the [sort] to the cache key anyway, because that affects the entire set. |
Hmm. On Sun, Apr 5, 2015 at 12:58 PM Pieter Soudan [email protected]
|
I think, when you want to support paging, you'll have to do some handling for sort, limit and skip options. This doesn't have to affect your backend. It's up to the developer using SearchSource to provide options for skip, limit and sort or not. They are entirely optional. |
Wow this is awesome! |
This is great - I can't wait to use this. |
+1 Is this extension already available somewhere? I was trying to set-up search-source with paging, but could not find a "skip" parameter. |
I spent some time with the fork from @Sewdn and rebased it against master as https://github.com/ShonM/search-source. I don't plan to maintain it, just wanted it for a quick side project and thought I'd link it here. |
Store the range of data that is already loaded for a query and merge subsequent data payloads in history.
This supports the use case for paged search-results (infinite scroll).
I'll deploy an example app shortly.
I will also update readme and add tests if you're interested in this PR.
Kr, Pieter