Skip to content

Commit

Permalink
Fixing search count
Browse files Browse the repository at this point in the history
  • Loading branch information
Aidan Whiteley committed Oct 6, 2024
1 parent 35f2afb commit 4513077
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>com.aidanwhiteley</groupId>
<artifactId>books</artifactId>
<version>0.42.0-RELEASE</version>
<version>0.42.1-RELEASE</version>
<packaging>jar</packaging>

<name>Books Microservice</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,11 @@ public Page<Book> searchForBooks(String searchPhrase, Pageable pageable) {

List<Book> books = mongoTemplate.find(query, Book.class);

Query countQuery = TextQuery.queryText(criteria);

return PageableExecutionUtils.getPage(
books,
pageable,
() -> mongoTemplate.count(query, Book.class));
() -> mongoTemplate.count(countQuery, Book.class));
}
}

0 comments on commit 4513077

Please sign in to comment.