Problem with graphql @index directive

I’m trying to add an index GraphQL query

I created the Index (works well in FQL),

  name: 'quotes_reversed',
  source: Collection('Quote'),
  values: [{ field: ['ref'], reverse: true }],

and then added in my GraphQL schema

quotesReversed: [Quote] @index(name: "quotes_reversed")

but when I try to UPDATE SCHEMA in Fauna’s console, it says:

“Error updating GraphQL schema.: Instance data is not valid”

I’m not sure if it’s my fault or is it a bug

You cannot specify values for an Index used with @index.

The error is not very helpful, but it is working as intended. Not a bug, but perhaps unfortunate that it cannot work.

There is a Topic for feedback on this, and also suggests a workaround of using a UDF with @resolver.

1 Like

I got the same question but now it is a search so it has to use a resolver but I don’t know what to put in the lambda params
Query( Lambda( ['size', 'after', 'before'],
where to I put the searchText input from the graphql query?

customerByStartsWith(searchText: String!): [Customer!]
    @resolver(name: "customerByStartsWith", paginated: true)

would it be
Query( Lambda( ['size', 'after', 'before', 'searchText'],?
I can’t find documentation on which params other than size, after, before does a paginated: true use

Hey @vasco3, check this out:

Thank you that worked !