CouchDB 3 full-text search bookmark for previous page
- Dominant language
- Erlang
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 9
Description
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.
Contributor guide
Research direction
The issue concerns CouchDB full-text search bookmarks and pagination; start by reviewing the search API behavior for bookmarks and reversed sort order. Done means a user can revisit a page and generate the correct previous-page link without passing every earlier bookmark.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- erlang
- Domain
- api, databases, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100