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

add vector support for graphQL #9067

Closed
wants to merge 3 commits into from
Closed

add vector support for graphQL #9067

wants to merge 3 commits into from

Conversation

shivaji-kharse
Copy link
Contributor

Title format:

  • Topic(Area): Feature
  • Topic must be one of build|ci|docs|feat|fix|perf|refactor|chore|test
  • Area must be one of acl|audit|backup|badger|cdc|dql|export|graphql|indexing|multi-tenancy|raft|restore|upgrade|zero
    • Add [BREAKING] if it is a breaking change

Body Format:

Description:
Fixes:
Closes:
Docs:

@shivaji-kharse shivaji-kharse requested a review from a team as a code owner April 8, 2024 14:57
@dgraph-bot dgraph-bot added area/testing Testing related issues area/graphql Issues related to GraphQL support on Dgraph. area/core internal mechanisms go Pull requests that update Go code labels Apr 8, 2024
@shivaji-kharse shivaji-kharse force-pushed the shiva/graphQL branch 2 times, most recently from 6474add to 0dc9fcd Compare April 11, 2024 14:08
graphql/admin/endpoints_ee.go Outdated Show resolved Hide resolved
graphql/e2e/auth/add_mutation_test.go Outdated Show resolved Hide resolved
graphql/dgraph/graphquery.go Show resolved Hide resolved
graphql/e2e/auth/debug_off/debugoff_test.go Outdated Show resolved Hide resolved
graphql/schema/wrappers.go Show resolved Hide resolved
@@ -669,6 +673,13 @@ func genDgSchema(gqlSch *ast.Schema, definitions []string,
}
}

embedding := f.Directives.ForName(embeddingDirective)
if embedding != nil {
// embeddingValidation ensured GQL type is [Float]
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if we first have a schema with normal [Float], but then we add embedding

if field.Type.NamedType == "String" ||
field.Type.NamedType == "Int" ||
field.Type.NamedType == "Int64" {
if field.Type.String() == "String!" ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Test

// hnsw
// hnsw(exponent: 3)
func parseSearchOptions(searchArg string) (map[string]string, bool) {
searchArg = strings.TrimSpace(searchArg)
Copy link
Contributor

Choose a reason for hiding this comment

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

tests

graphql/schema/rules.go Outdated Show resolved Hide resolved
// }
func rewriteAsSimilarByEmbeddingQuery(
query schema.Query, auth *authRewriter) []*dql.GraphQuery {

Copy link
Contributor

Choose a reason for hiding this comment

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

can you cehck if auth works?

@shivaji-kharse shivaji-kharse force-pushed the shiva/graphQL branch 2 times, most recently from 59622a2 to dd806c2 Compare April 17, 2024 05:58
type Project {
id: ID!
title: String! @search(by: [exact])
title_v: [Float!] @hm_embedding @search(by: ["hnsw(metric: euclidian, exponent: 4)"])
Copy link
Contributor

Choose a reason for hiding this comment

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

just @ embedding

@@ -37,7 +37,7 @@ func TestDgraphMapping_WithoutDirectives(t *testing.T) {
type Author {
id: ID!

name: String! @search(by: [hash, trigram])
name: String! @search(by: ["hash", "trigram"])
Copy link
Contributor

Choose a reason for hiding this comment

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

old thing should still work. We should not expect customers to change this

Product.title : Product.title
Product.productVector : Product.productVector
dgraph.uid : uid
Product.hm_distance : val(distance)
Copy link
Contributor

Choose a reason for hiding this comment

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

hm_distance to distance

}

type Project1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename this to ProjectDotProduct, and ProjectCosine instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core internal mechanisms area/graphql Issues related to GraphQL support on Dgraph. area/testing Testing related issues go Pull requests that update Go code
Development

Successfully merging this pull request may close these issues.

3 participants