Skip to content

[feature]: Implement a search query聽#3889

Description

@hindochahitarth

馃憖 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions