Skip to content

Feature/search books#120

Open
hindochahitarth wants to merge 4 commits intokeploy:mainfrom
hindochahitarth:feature/Search-Books
Open

Feature/search books#120
hindochahitarth wants to merge 4 commits intokeploy:mainfrom
hindochahitarth:feature/Search-Books

Conversation

@hindochahitarth
Copy link

@hindochahitarth hindochahitarth commented Feb 28, 2026

Pull Request Template

GDG CHARUSAT TEAM ID Team 137

Description

This PR introduces a Partial Title Search functionality for books. Previously, users could only fetch books by their exact name using getBookByName. This enhancement allows users to find books even if they only know a fragment of the title, with support for case-insensitivity.

Summary of changes:

BookRepository
Added a new query method findByNameContainingIgnoreCase(String name) to leverage Spring Data JPA's derived query feature.

schema.graphqls
Introduced the searchBooks(title: String!): [Book] query to the GraphQL schema.

BookController
Implemented the @QueryMapping for searchBooks to connect the GraphQL entry point with the repository logic.
Fixes keploy/keploy#3888

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

The changes were verified manually using curl against the local GraphQL endpoint.

Test Case: Partial and Case-Insensitive Search

Setup: Ensure at least one book exists, e.g., "The Great Gatsby".
Execution: Run the following curl command:
bash
curl -X POST http://localhost:8081/graphql
-H "Content-Type: application/json"
-d '{"query": "{ searchBooks(title: "great") { name author { firstName lastName } } }"}'
Expected Result: The API returns an array containing "The Great Gatsby", even though the search term "great" was lowercase.

Additional Context (Please include any Screenshots/gifs if relevant)

This feature improves the discoverability of books in the library system and provides a more user-friendly search experience compared to exact matching.
...

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings
  • I have tagged the reviewers in a comment below incase my pull request is ready for a review
  • I have signed the commit message to agree to Developer Certificate of Origin (DCO) (to certify that you wrote or otherwise have the right to submit your contribution to the project.) by adding "--signoff" to my git commit command.

GDG CHARUSAT TEAM ID Team 137

X
feat:Added CRUD Operations for book and author

Signed-off-by: Hitarth Hindocha <hindochahitarth@gmail.com>
Signed-off-by: Hitarth Hindocha <hindochahitarth@gmail.com>
Signed-off-by: Hitarth Hindocha <hindochahitarth@gmail.com>
Signed-off-by: Hitarth Hindocha <hindochahitarth@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature]: Search Books by Name (Partial Match)

1 participant