diff --git a/query/query1_test.go b/query/query1_test.go index 7ad83ae8e77..65fe183825a 100644 --- a/query/query1_test.go +++ b/query/query1_test.go @@ -2545,3 +2545,31 @@ func TestExpandAll_empty_panic(t *testing.T) { js := processQueryNoErr(t, query) require.JSONEq(t, `{"data":{"me":[]}}`, js) } + +func TestMatchFuncWithAfter(t *testing.T) { + query := ` + { + q(func: match(name, Ali, 5), after: 0x2710) { + uid + name + } + } + ` + + js := processQueryNoErr(t, query) + require.JSONEq(t, `{"data": {"q": [{"name": "Alice", "uid": "0x2712"}, {"name": "Alice", "uid": "0x2714"}]}}`, js) +} + +func TestCompareFuncWithAfter(t *testing.T) { + query := ` + { + q(func: eq(name, Alice), after: 0x2710) { + uid + name + } + } + ` + + js := processQueryNoErr(t, query) + require.JSONEq(t, `{"data": {"q": [{"name": "Alice", "uid": "0x2712"}, {"name": "Alice", "uid": "0x2714"}]}}`, js) +} \ No newline at end of file diff --git a/query/query2_test.go b/query/query2_test.go index 74e98b0d75a..6642474cc4a 100644 --- a/query/query2_test.go +++ b/query/query2_test.go @@ -3133,3 +3133,16 @@ func TestLangDotInFunction(t *testing.T) { `{"data": {"me":[{"name@pl":"Borsuk europejski","name@en":"European badger"},{"name@en":"Honey badger"},{"name@en":"Honey bee"}]}}`, js) } + +func TestGeoFuncWithAfter(t *testing.T) { + + query := `{ + me(func: near(geometry, [-122.082506, 37.4249518], 1000), after: 0x13ee) { + name + } + }` + + js := processQueryNoErr(t, query) + expected := `{"data": {"me":[{"name": "SF Bay area"}, {"name": "Mountain View"}]}}` + require.JSONEq(t, expected, js) +} diff --git a/query/query3_test.go b/query/query3_test.go index 1c225a55eaa..6ceeb784f77 100644 --- a/query/query3_test.go +++ b/query/query3_test.go @@ -3216,3 +3216,17 @@ func TestMultiRegexInFilter2(t *testing.T) { require.JSONEq(t, `{"data": {"q": [{"firstName": "Han", "lastName":"Solo"}]}}`, res) } } + +func TestRegexFuncWithAfter(t *testing.T) { + query := ` + { + q(func: regexp(name, /^Ali/i), after: 0x2710) { + uid + name + } + } + ` + + res := processQueryNoErr(t, query) + require.JSONEq(t, `{"data": {"q": [{"name": "Alice", "uid": "0x2712"}, {"name": "Alice", "uid": "0x2714"}]}}`, res) +} \ No newline at end of file diff --git a/worker/match.go b/worker/match.go index fc354159434..21e6fa2a640 100644 --- a/worker/match.go +++ b/worker/match.go @@ -83,6 +83,7 @@ func uidsForMatch(attr string, arg funcArgs) (*roaring64.Bitmap, error) { opts := posting.ListOptions{ ReadTs: arg.q.ReadTs, First: int(arg.q.First), + AfterUid: arg.q.AfterUid, } uidsForNgram := func(ngram string) (*roaring64.Bitmap, error) { key := x.IndexKey(attr, ngram) diff --git a/worker/trigram.go b/worker/trigram.go index cce3d36ef1e..bd35fbb54f6 100644 --- a/worker/trigram.go +++ b/worker/trigram.go @@ -37,6 +37,7 @@ func uidsForRegex(attr string, arg funcArgs, opts := posting.ListOptions{ ReadTs: arg.q.ReadTs, First: int(arg.q.First), + AfterUid: arg.q.AfterUid, } // TODO: Unnecessary conversion here. Avoid if possible. if !intersect.IsEmpty() {