-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
👀 Is there an existing feature request for this?
- I have searched the existing issues
🔖 Enhancement description
Problem
The current
getBookByName
query only supports exact name matches. If a user doesn't know the full title of a book, they cannot find it easily. This makes the interface less user-friendly, as users are required to remember the precise title to retrieve any information.
Proposed Solution
Implement a search query that supports partial name matching using SQL LIKE.
Repository: Add List findByNameContainingIgnoreCase(String name) to
BookRepository
. This utilizes Spring Data JPA's derived query methods to perform a case-insensitive partial match.
GraphQL Schema:
graphql
extend type Query {
searchBooks(title: String!): [Book]
}
Controller: Add a @QueryMapping for
searchBooks
that calls the new repository method.
Expected Behavior
Users can input a partial string (e.g., "Great").
The system returns all books whose titles contain that string (e.g., "The Great Gatsby", "Great Expectations").
The search remains case-insensitive.
🎤 Why should this be worked on?
Improved UX: Significantly improves the user search experience by allowing flexible queries.
Efficiency: Handles case-insensitivity and partial matching automatically at the database level rather than filtering in memory.
API Completeness: Brings the GraphQL API closer to production standards for search functionality.
💻 Repository spring-boot-postgres-graphql
GDG CHARUSAT TEAM : T137
💻 Repository
keploy