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 (DGRAPH-2601) #6996

Merged
merged 3 commits into from
Nov 26, 2020

Conversation

abhimanyusinghgaur
Copy link
Contributor

@abhimanyusinghgaur abhimanyusinghgaur commented Nov 26, 2020

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.


This change is Reviewable

@netlify
Copy link

netlify bot commented Nov 26, 2020

Deploy preview for dgraph-docs ready!

Built with commit 023dae1

https://deploy-preview-6996--dgraph-docs.netlify.app

Copy link
Contributor

@pawanrawal pawanrawal left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r1, 2 of 2 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @danielmai, @manishrjain, @MichaelJCompton, and @vvbalaji-dgraph)

@abhimanyusinghgaur abhimanyusinghgaur merged commit 0b11439 into master Nov 26, 2020
@abhimanyusinghgaur abhimanyusinghgaur deleted the abhimanyu/tokenizer branch November 26, 2020 12:21
OmarAyo pushed a commit that referenced this pull request Dec 1, 2020
…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 pushed a commit that referenced this pull request Dec 1, 2020
…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 added a commit that referenced this pull request Dec 3, 2020
…PH-2601) (#6996) (#7033)

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)

Co-authored-by: Abhimanyu Singh Gaur <12651351+abhimanyusinghgaur@users.noreply.github.com>
OmarAyo added a commit that referenced this pull request Dec 21, 2020
…PH-2601) (#6996) (#7035)

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)

Co-authored-by: Abhimanyu Singh Gaur <12651351+abhimanyusinghgaur@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing Testing related issues
Development

Successfully merging this pull request may close these issues.

2 participants