Help with sub filtering in a query

Hi,

I have this question here filter results upon connections filterring.
@amaster507 suggested using parametrized cascade or DQL
I would like to have some help with one of these methods.

Note: I have an update to my scheme and I want to create a query that returns all the repositories that have the search term in their name, description or tags. Then I want to order the results base on the number of visits.

Here is the scheme:

interface IVisit {
  id: ID
  visitor: User!
  timestamp: DateTime! @search(by: [day])
}

type RepositoryVisit implements IVisit {
  repository: Repository! @hasInverse(field: visits)
}

type UserVisit implements IVisit {
  user: User! @hasInverse(field: visits)
}

type Repository {
  id: ID!
  name: String! @search(by: [regexp, term, exact])
  description: String @search(by: [term, regexp])
  branches: [Branch!]!
  activeMemberships: [Membership!]!
  isPublic: Boolean! @search
  tags: [Hashtag!] @hasInverse(field: appearsOn)
  createdAt: DateTime! @search(by: [month])
  numOfStars: Int
  visits: [RepositoryVisit!]
}

type User {
  username: String! @search(by: [hash, regexp]) @id
  name: String
  email: String! @search(by: [hash, regexp])
  memberships: [Membership!] @hasInverse(field: belongsTo)
  hasCredentials: [Credentials!] @hasInverse(field: forUser)
  visits: [UserVisit!]
  joinedAt: DateTime @search(by: [month])
}

If there is a way to do that in GQL I would like to know too.

Thanks,
Spinelsun

Hi @spinelsun, query is currently not possible in GraphQL but we would look into supporting it in the future.

Maybe subquery would be an idea for a solution.
If I could give a filter or order a query that returns ids or any scalar type it will solve most of the problem.
It is sort of what’s hapenning with DQL vars

1 Like