Open
Description
I have a GraphQLRepository that extends QueryByExampleExectutor
@GraphQlRepository
public interface BookRepository extends JpaRepository<Book, Long>, QueryByExampleExecutor<Book> {}
If I try to do a partial match on the book title no results come back. If I enter the full book title the results come back as expected.
// Find books by partial title match
query {
books(book: { title: "Spring Boot" }) {
id
title
author
publishedYear
}
}
I realize I can write a data fetcher for this but this:
@Controller
public class BookController {
private final BookRepository repository;
public BookController(BookRepository repository) {
this.repository = repository;
}
@QueryMapping
public List<Book> booksContaining(@Argument(name = "book") Book filterBook) {
ExampleMatcher matcher = ExampleMatcher.matching()
.withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING)
.withIgnoreCase()
.withIgnoreNullValues();
Example<Book> example = Example.of(filterBook, matcher);
return repository.findAll(example);
}
}
But I would like a way to customize this so I can use a StringMatcher.CONTAINING
and match on part of the book title.