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

fix(pagination): Fix after for regexp, match functions #7700

Merged
merged 2 commits into from
Apr 13, 2021

Conversation

rohanprasad
Copy link
Contributor

@rohanprasad rohanprasad commented Apr 7, 2021

This change fixes the pagination functioning that used "after" to specify a UID as offset.

Fixes DGRAPH-3222


This change is Reviewable

Copy link
Contributor

@ahsanbarkati ahsanbarkati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 5 files reviewed, 1 unresolved discussion (waiting on @manishrjain, @pawanrawal, @rohanprasad, and @vvbalaji-dgraph)


worker/task.go, line 1547 at r1 (raw file):

			}
			var tv pb.TaskValue
			err = pl.Iterate(arg.q.ReadTs, 0, func(p *pb.Posting) error {

The second argument in Iterate() function is for afterUid. You can just pass it there, so no need for the if block below.

Copy link
Contributor

@NamanJain8 NamanJain8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a bunch of places where we are setting AfterUid to 0. Can you check what might be the reason for that? Or do we actually need to add this AfterUid check over there as well.

@rohanprasad
Copy link
Contributor Author


worker/task.go, line 1547 at r1 (raw file):

Previously, ahsanbarkati (Ahsan Barkati) wrote…

The second argument in Iterate() function is for afterUid. You can just pass it there, so no need for the if block below.

Verified, this works fine without the change.

@rohanprasad rohanprasad merged commit c11a607 into master Apr 13, 2021
@rohanprasad rohanprasad deleted the rohanprasad/fix_pagination branch April 13, 2021 06:26
all-seeing-code pushed a commit that referenced this pull request Dec 1, 2022
* fix(pagination): Fix after for regexp, match functions
* Add test for pagination with other functions

(cherry picked from commit c11a607)
all-seeing-code pushed a commit that referenced this pull request Dec 6, 2022
* fix(pagination): Fix after for regexp, match functions
* Add test for pagination with other functions

(cherry picked from commit c11a607)
all-seeing-code added a commit that referenced this pull request Dec 7, 2022
Match, Compare, Regexp and Geo functions didn't work with `after`
attribute. The PR fixes that.

With this PR, the following type of queries are possible:

```
{
	q(func: match(name, Ali, 5), after: 0x2710) {
		uid
		name
	}
}
```


(cherry picked from commit c11a607)

Co-authored-by: Rohan Prasad <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants