DATAREDIS-623 - Fix RedisQueryEngine.count(…) with proper SINTER/SUNION usage.

Backport of RedisQueryEngine#count(RedisOperationChain, Serializable) fix using multiple indexed keys.

Related ticket: DATAREDIS-605.
Original pull request: #330.
This commit is contained in:
Zhongning Fan
2018-04-11 22:10:11 +08:00
committed by Mark Paluch
parent c6540ec387
commit f61b0d6fad
3 changed files with 41 additions and 20 deletions

View File

@@ -345,6 +345,22 @@ public abstract class RedisRepositoryIntegrationTestBase {
assertThat(result, not(hasItems(p1)));
}
@Test // DATAREDIS-623
public void pageableQueryWithTwoKeywordsShouldReturnCorrectly() {
Person eddard = new Person("eddard", "stark");
Person robb = new Person("robb", "stark");
Person sansa = new Person("sansa", "stark");
repo.save(Arrays.asList(eddard, robb, sansa));
Page<Person> page1 = repo.findByFirstnameAndLastname("sansa", "stark", new PageRequest(0, 2));
assertThat(page1.getNumberOfElements(), is(1));
assertThat(page1.getContent(), hasSize(1));
assertThat(page1.getTotalElements(), is(1L));
}
public static interface PersonRepository extends PagingAndSortingRepository<Person, String> {
List<Person> findByFirstname(String firstname);
@@ -355,6 +371,8 @@ public abstract class RedisRepositoryIntegrationTestBase {
List<Person> findByFirstnameAndLastname(String firstname, String lastname);
Page<Person> findByFirstnameAndLastname(String firstname, String lastname, Pageable page);
List<Person> findByFirstnameOrLastname(String firstname, String lastname);
List<Person> findFirstBy();