Skip to content

Conversation

bsbodden
Copy link
Collaborator

  • Add PartTree limit checking in RediSearchQuery.processPartTree()
  • Methods like findTop2ByOrderByNameAsc now correctly pass limit to Redis
  • Fixes issue where all methods returned default 10000 results
  • Add comprehensive tests for various limiting scenarios

Fixes #630

- Add PartTree limit checking in RediSearchQuery.processPartTree()
- Methods like findTop2ByOrderByNameAsc now correctly pass limit to Redis
- Fixes issue where all methods returned default 10000 results
- Add comprehensive tests for various limiting scenarios

Fixes redis#630
@bsbodden bsbodden requested a review from Copilot July 31, 2025 20:47
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug where findTop/findFirst repository methods were not properly respecting limit specifications in Redis OM Spring. Previously, methods like findTop2ByOrderByNameAsc would return the default 10,000 results instead of the expected 2 results.

  • Added limit checking in RediSearchQuery.processPartTree() to extract limits from method names
  • Created comprehensive test coverage for various limiting scenarios (findTop, findFirst, with different numeric limits)
  • Added repository interfaces with limiting method definitions for testing

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
RediSearchQuery.java Core fix to extract and apply limits from PartTree parsing
FindTopLimitingTest.java Comprehensive test suite for limiting functionality
CompanyRepositoryWithLimiting.java Test repository interface with limiting methods
CompanyRepository.java Added limiting methods to existing repository for testing

@bsbodden bsbodden merged commit 53c2212 into redis:main Jul 31, 2025
1 check passed
@bsbodden bsbodden deleted the bsb/find_by_one_find_top_bug branch July 31, 2025 20:49
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.

bug: findByOne and findTop not passing limit to Query Engine

1 participant