hydra icon indicating copy to clipboard operation
hydra copied to clipboard

Entity property in multiple fulltext searches

Open ondratra opened this issue 3 years ago • 1 comments

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")
}

ondratra avatar Sep 14 '21 08:09 ondratra

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.

dzhelezov avatar Oct 03 '21 15:10 dzhelezov