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

Potential bug with logical operators _or, _and when using aliases. #3468

Open
fredcarle opened this issue Feb 19, 2025 · 0 comments
Open

Potential bug with logical operators _or, _and when using aliases. #3468

fredcarle opened this issue Feb 19, 2025 · 0 comments

Comments

@fredcarle
Copy link
Collaborator

fredcarle commented Feb 19, 2025

It seems like filtering using logical operator _or, _and when using aliases is causing the result to be wrong (empty in the case bellow).

func TestQuerySimple_WithTwoSimilarityAndFilteringOnBoth_ShouldSucceed(t *testing.T) {
	test := testUtils.TestCase{
		Description: "Simple query, similarity on empty",
		Actions: []any{
			testUtils.SchemaUpdate{
				Schema: `type User {
					name: String
					pointsList: [Int!]
				}`,
			},
			testUtils.CreateDoc{
				DocMap: map[string]any{
					"name":       "John",
					"pointsList": []int64{2, 4, 1},
				},
			},
			testUtils.CreateDoc{
				DocMap: map[string]any{
					"name":       "Bob",
					"pointsList": []int64{1, 1, 1},
				},
			},
			testUtils.CreateDoc{
				DocMap: map[string]any{
					"name":       "Alice",
					"pointsList": []int64{4, 5, 3},
				},
			},
			testUtils.Request{
				Request: `query {
					User(filter: {_or: [{_alias: {sim2: {_gt: 20}}}, {_alias: {sim: {_lt: 10}}}]}){
						name
						sim: _similarity(pointsList: {vector: [1, 2, 0]})
						sim2: _similarity(pointsList: {vector: [2, 3, 0]})
					}
				}`,
				Results: map[string]any{
					"User": []map[string]any{},
				},
			},
		},
	}

	testUtils.ExecuteTestCase(t, test)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant