-
Notifications
You must be signed in to change notification settings - Fork 14
Add ngram updates #189
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
Add ngram updates #189
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,7 @@ enum DgraphIndex { | |
| term | ||
| fulltext | ||
| trigram | ||
| ngram | ||
| regexp | ||
| year | ||
| month | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -85,15 +85,13 @@ | |||||
|
|
||||||
| ```graphql | ||||||
| queryAuthor(filter: { name: { eq: "Diggy" } } ) { | ||||||
| posts(filter: { title: { anyofterms: "GraphQL" }}) { | ||||||
| title | ||||||
| } | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| Dgraph can build search types with the ability to search between a range. For | ||||||
| example with the above Post type with datePublished field, a query can find | ||||||
| publish dates within a range | ||||||
| example, with the preceding Post type with the `datePublished` field, a query | ||||||
| can find publish dates within a range. | ||||||
|
|
||||||
| ```graphql | ||||||
| query { | ||||||
|
|
@@ -104,8 +102,8 @@ | |||||
| ``` | ||||||
|
|
||||||
| Dgraph can also build GraphQL search ability to find match a value from a list. | ||||||
| For example with the above Author type with the name field, a query can return | ||||||
| the Authors that match a list | ||||||
| For example with the preceding Author type with the name field, a query can | ||||||
| return the Authors that match a list | ||||||
|
|
||||||
| ```graphql | ||||||
| queryAuthor(filter: { name: { in: ["Diggy", "Jarvis"] } } ) { | ||||||
|
|
@@ -115,13 +113,13 @@ | |||||
|
|
||||||
| There's different search possible for each type as explained below. | ||||||
|
|
||||||
| ### Int, Float and DateTime | ||||||
| ### Int, float and dateTime | ||||||
|
|
||||||
| | argument | constructed filter | | ||||||
| | -------- | ------------------------------------------------- | | ||||||
| | none | `lt`, `le`, `eq`, `in`, `between`, `ge`, and `gt` | | ||||||
|
|
||||||
| Search for fields of types `Int`, `Float` and `DateTime` is enabled by adding | ||||||
| Search for fields of types `Int`, `Float` and `dateTime` is enabled by adding | ||||||
| `@search` to the field with no arguments. For example, if a schema contains: | ||||||
|
|
||||||
| ```graphql | ||||||
|
|
@@ -187,7 +185,7 @@ | |||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| ### DateTime | ||||||
| ### dateTime | ||||||
|
|
||||||
| | argument | constructed filters | | ||||||
| | --------------------------------- | ------------------------------------------------- | | ||||||
|
|
@@ -198,14 +196,14 @@ | |||||
| defaults to year, but once you understand your data and query patterns, you | ||||||
| might want to changes that like `@search(by: [day])`. | ||||||
|
|
||||||
| ### Boolean | ||||||
| ### Boolean fields | ||||||
|
|
||||||
| | argument | constructed filter | | ||||||
| | -------- | ------------------ | | ||||||
| | none | `true` and `false` | | ||||||
|
|
||||||
| Booleans can only be tested for true or false. If `isPublished: Boolean @search` | ||||||
| is in the schema, then the search allows | ||||||
| Boolean fields can only be tested for `true` or `false`. If | ||||||
| `isPublished: Boolean @search` is in the schema, then the search allows | ||||||
|
|
||||||
| ```graphql | ||||||
| filter: { isPublished: true } | ||||||
|
|
@@ -229,6 +227,7 @@ | |||||
| | `regexp` | `regexp` (regular expressions) | | ||||||
| | `term` | `allofterms` and `anyofterms` | | ||||||
| | `fulltext` | `alloftext` and `anyoftext` | | ||||||
| | `ngram` | `ngram` | | ||||||
|
|
||||||
| - _Schema rule_: `hash` and `exact` can't be used together. | ||||||
|
|
||||||
|
|
@@ -250,7 +249,7 @@ | |||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| to find users with names lexicographically after "Diggy". | ||||||
| to find users with names lexicographically after "Diggy." | ||||||
|
|
||||||
| #### String regular expression search | ||||||
|
|
||||||
|
|
@@ -283,12 +282,8 @@ | |||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| will match all posts with both "GraphQL and "tutorial" in the title, while | ||||||
| `anyofterms: "GraphQL tutorial"` would match posts with either "GraphQL" or | ||||||
| "tutorial". | ||||||
|
|
||||||
| `fulltext` search is Google-stye text search with stop words, stemming. etc. So | ||||||
| `alloftext: "run woman"` would match "run" as well as "running", etc. For | ||||||
| example, to find posts that talk about fantastic GraphQL tutorials: | ||||||
|
||||||
| example, to find posts that talk about fantastic GraphQL tutorials: | |
| Fulltext search differs from term search in that it supports stemming and stop word removal. This means that queries using fulltext search will match words with similar roots (e.g., "tutorial" and "tutorials") and ignore common stop words (e.g., "the", "and", "is"). For example, to find posts that talk about fantastic GraphQL tutorials: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code block is incomplete - it's missing the closing brace and content. The removal of lines 88-89 appears to have left this query example broken.