Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing search functionality in Prisma/GraphQL

I want to implement a simple searching functionality with Prisma I have seen some info about using the where clause but it’s case sensitive so it’s not a good solution.

I’ve also seen some tutorials using external services. I don’t want to use any external services. I’d like to do something as simple as possible.

Any way I can tweak the query to be case insensitive? or any other approach you guys recommend?

Thanks :)

like image 368
JV Lobo Avatar asked Dec 05 '18 04:12

JV Lobo


People also ask

What is Prisma in GraphQL?

Prisma is an ORM that is used inside of GraphQL resolvers to query a database. It works perfectly with all your favorite tools and libraries from the GraphQL ecosystem. You can use it with SDL-first and code-first GraphQL schemas and with any server library such as Apollo Server, Express, NestJS or Mercurius.

How to do a text search in Prisma?

I'd recommend making a separate database client to connect to the prisma database not through prisma client, and just do a text search using the standard db client. For example, if you want to use mongodb for prisma, you can just use the mongo client in your resolver to perform a text search

How does Prisma work as a backend developer?

However, as a backend developer, you are still responsible for how your GraphQL server retrieves the requested data from the database by implementing your GraphQL resolvers – that's where Prisma comes in. Prisma is an ORM that is used inside of GraphQL resolvers to query a database.

What is Prisma client?

Map your Prisma schema to the database so you don't need to write SQL to manage your database schema. Prisma Client reduces boilerplates by providing convenient APIs for common database features. At Prisma, we love GraphQL and believe in its bright future.


Video Answer


1 Answers

This feature isn't implemented yet: https://github.com/prisma/prisma1/issues/1183

However, you can have a raw access to your database if it supports this feature: https://www.prisma.io/docs/prisma-graphql-api/reference/raw-database-access-qwe4/#overview

like image 106
Errorname Avatar answered Sep 29 '22 01:09

Errorname