Joystream / hydra

A Substrate indexing framework
48 stars 45 forks source link

Entity property in multiple fulltext searches #457

Open ondratra opened 2 years ago

ondratra commented 2 years ago

It seems that we can't include one entity property in multiple fulltext searches at the moment. An example scenario when this is needed is if we want to have one fulltext search searching exclusively in forum posts texts. And in the same time, have a second, more general fulltext search searching in forum posts' text, videos' and channels' descriptions, etc.

This schema is working:

type ForumPost @entity {
  title: String @fulltext(query: "forumPostSearch") 
} 

This schema is not supported:

type ForumPost @entity {
  # one possible definition
  title: String @fulltext(query: "forumPostSearch") @fulltext(query: "globalSearch")

  # possible alternative definition
  title: String @fulltext(query: ["forumPostSearch", "globalSearch"])
} 

type Video @entity {
  description: @fulltext(query: "globalSearch")
}
dzhelezov commented 2 years ago

Perhaps we can replace the field-level @query with an object-level directive (e. g. '@FullTextQuery' similarly to how TheGraph does that). The rationale is that there will be extra parameters to tune in the future (e.g. language, strict/partial matches etc) that'd translate to different Postgres full-text searches.