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(DQL): ignore ordering of indexes in schema with eq function (DGRA… #7035

Merged
merged 1 commit into from
Dec 21, 2020

Conversation

OmarAyo
Copy link
Contributor

@OmarAyo OmarAyo commented Dec 1, 2020

Previously, the following schema:

name: string @index(trigram, term) .

with some added data, and the following query:

query {
	q(func: eq(name, "Alice", "Bob")) {
		uid
		name
	}
}

would error out saying it doesn't have a valid tokenizer:

{
  "errors": [
    {
      "message": ": Attribute name does not have a valid tokenizer.",
      "extensions": {
        "code": "ErrorInvalidRequest"
      }
    }
  ],
  "data": null
}

even though term index is present on the predicate.
On the other hand, if you reversed the order of indexes:

name: string @index(term, trigram) .

It would give correct results:

{
  "data": {
    "q": [
      {
        "uid": "0x2",
        "name": "Alice",
        "age": 20
      },
      {
        "uid": "0x3",
        "name": "Bob",
        "age": 25
      }
    ]
  }
}

This PR fixes the above issue.

(cherry picked from commit 0b11439)


This change is Reviewable

…PH-2601) (#6996)

Fixes DGRAPH-2601

Previously, the following schema:
```
name: string @index(trigram, term) .
```
with some added data, and the following query:
```
query {
	q(func: eq(name, "Alice", "Bob")) {
		uid
		name
	}
}
```
would error out saying it doesn't have a valid tokenizer:
```
{
  "errors": [
    {
      "message": ": Attribute name does not have a valid tokenizer.",
      "extensions": {
        "code": "ErrorInvalidRequest"
      }
    }
  ],
  "data": null
}
```
even though `term` index is present on the predicate.
On the other hand, if you reversed the order of indexes:
```
name: string @index(term, trigram) .
```
It would give correct results:
```
{
  "data": {
    "q": [
      {
        "uid": "0x2",
        "name": "Alice",
        "age": 20
      },
      {
        "uid": "0x3",
        "name": "Bob",
        "age": 25
      }
    ]
  }
}
```

This PR fixes the above issue.

(cherry picked from commit 0b11439)
@OmarAyo OmarAyo added the area/indexes Related to indexes (indices) and their usage. label Dec 1, 2020
@OmarAyo OmarAyo requested a review from danielmai December 1, 2020 14:25
Copy link
Contributor

@danielmai danielmai left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 3 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @manishrjain and @MichaelJCompton)

Copy link
Contributor

@danielmai danielmai left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 3 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @manishrjain and @MichaelJCompton)

@OmarAyo OmarAyo merged commit 27e9f4b into release/v1.2 Dec 21, 2020
@OmarAyo OmarAyo deleted the omar/v1.2-fix-index-ordering branch December 21, 2020 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/indexes Related to indexes (indices) and their usage.
Development

Successfully merging this pull request may close these issues.

3 participants