Skip to content
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

CouchDB 3 full-text search bookmark for previous page #2766

Open
toyssamurai opened this issue Apr 8, 2020 · 1 comment
Open

CouchDB 3 full-text search bookmark for previous page #2766

toyssamurai opened this issue Apr 8, 2020 · 1 comment

Comments

@toyssamurai
Copy link

There should be a way to generate a previous page link using a bookmark.

Summary

Let's say I have 3 pages of results, Page 1, 2, and 3. It's a bit confusing, so bear with me please.

Page 1 returns a bookmark: bk-pg2. I can use this bookmark to generate a next link in Page 1. I can also pass a made-up bookmark for Page 2 to go back to Page 1. Let's use bk-dummy. And there will be no previous link in this page.

The user clicks on the next link in Page 1 and arrives at Page 2.

Page 2 returns a bookmark: bk-pg3. Now, I can use the made-up bookmark bk-dummy to generate a previous link to Page 1 (basically, just search for the same parameter without a bookmark). I can also use bk-pg3 to generate a next link to go to Page 3. In addition, I can also pass the current bookmark bk-pg2 to Page 3, so that it can use that to generate a previous link to Page 2.

The user, however, decides not to click the previous link and click the next link, then arrives at Page 3.

Page 3 now returns a bookmark: bk-pg4. To make things easier, let's just assume that I prefetch all the next link and determine that this bookmark will return no more results, therefore I won't display a next link here. But, Page 3 does receive the bookmark of Page 2, bk-pg2, and can use it to generate a previous link.

The user, now, decides to click the previous link and arrives at Page 2, again.

Now, the user is at Page 2, and my problem begins. From the user's perspective, if Page 2 has a previous link, it should lead to Page 1. However, even if I had passed a bookmark to Page 2 from Page 3, that bookmark would be the bookmark of Page 3, bk-pg3, which would only lead to Page 3, not Page 1!!!

A possible solution is to keep passing all previous bookmarks to the next page, but it just isn't a very elegant solution.

Desired Behaviour & Possible Solution

I guess/hope, if I reverse the sort order with the bookmark of the current page, CouchDB would give me the result of the previous page. But it doesn't currently.

@sgrigorev
Copy link

@toyssamurai have you found a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants