AHHHHHHHH I AM SO RETARDED NOW I FINALLY UNDERSTAND WHAT YOU MEANNNNNN yea that is true definitely!!! I should’ve written an example graphql schema to show better what I mean
type Restaurant {
id: ID!
name: String
restaurantrating: Int @search
businessrating: Int @search @dgraph(pred: "business.rating")
}
type Hotel {
id: ID!
name: String
hotelrating: Int @search
businessrating: Int @search @dgraph(pred: "business.rating")
}
E.g the new rating of a hotel is 4.5
I then update in one transaction hotelrating to 4.5 and businessrating to 4.5
so I’d basically store duplicate values. This is OK for an int like 4.5 which does not use up space, but if you think of the dog and cat blog example (a website where you can make blogposts about cats and dogs and hamsters), if using fulltext search, duplicating the text would be wasteful
type Catblogpost {
id: ID!
text: String @search(by: [fulltext])
text: String @search(by: [fulltext]) @dgraph(pred: "general.text")
}
type Dogblogpost {
id: ID!
text: String @search(by: [fulltext])
text: String @search(by: [fulltext]) @dgraph(pred: "general.text")
}
type Hamsterblogpost {
id: ID!
text: String @search(by: [fulltext])
text: String @search(by: [fulltext]) @dgraph(pred: "general.text")
}
for faster search we want an own index for every animal, e.g If I want to search something from the catblog | but we also want a general search if I want to search something in general
so my problem here is, that the blogtext is stored twice, what I want is something like this:
type Catblogpost {
id: ID!
text: String @search(by: [fulltext]) @dgraph(pred: "general.text", "catblogpost.text")
}
type Dogblogpost {
id: ID!
text: String @search(by: [fulltext]) @dgraph(pred: "general.text", "dogblogpost.text")
}
type Hamsterblogpost {
id: ID!
text: String @search(by: [fulltext]) @dgraph(pred: "general.text", "hamsterblogpost.text")
}
so I don’t have to store values twice and update two same values always
what I want is really highend first world problems optimization