Skip to content

feat: adds pagination#44

Merged
weited merged 4 commits intomainfrom
add-elastic-search-pagination
Aug 14, 2025
Merged

feat: adds pagination#44
weited merged 4 commits intomainfrom
add-elastic-search-pagination

Conversation

@gtrrz-victor
Copy link
Copy Markdown

No description provided.

@gtrrz-victor gtrrz-victor force-pushed the add-elastic-search-pagination branch from 6472255 to 62a9f8c Compare August 13, 2025 01:35
@gtrrz-victor gtrrz-victor marked this pull request as ready for review August 14, 2025 05:58
@weited weited requested a review from Copilot August 14, 2025 06:02
Copy link
Copy Markdown

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 adds pagination support to the SearchService class by implementing Point-in-Time (PIT) API for efficient scrolling through large result sets in Elasticsearch. The change replaces the previous approach of retrieving all results in a single large query with a paginated approach using search_after functionality.

  • Implements Point-in-Time (PIT) API with search_after pagination for large result sets
  • Refactors code formatting to improve consistency and readability
  • Replaces single large queries (20,000 records) with batched processing (5,000 and 1,000 record batches)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread src/main/java/au/org/aodn/oceancurrent/service/SearchService.java Outdated
Comment thread src/main/java/au/org/aodn/oceancurrent/service/SearchService.java Outdated
}, ImageMetadataEntry.class);

List<ImageMetadataEntry> hits = extractHits(response);
if (hits.isEmpty())
Copy link

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

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

The empty result check for findLatestCurrentMetersPlotByPlotName no longer throws ResourceNotFoundException when no data is found. The original logic after line 353 that threw an exception for empty results has been removed, which could change the API behavior.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@gtrrz-victor should throw not found

Integer highestVersion = ProductIdUtils.findHighestVersionNumber(allEntries,
PRODUCT_TYPE_CURRENT_METERS_PLOT);

if (highestVersion == null) {
Copy link

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

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

The check for empty results has been moved after the PIT processing, but now it only checks if highestVersion is null. If allEntries is empty, ProductIdUtils.findHighestVersionNumber will likely return null, but this doesn't provide the same specific error message that was originally thrown when no data was found.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@gtrrz-victor should throw not found

@weited weited force-pushed the add-elastic-search-pagination branch from 713fec0 to 61b2f9a Compare August 14, 2025 06:23
Copy link
Copy Markdown
Collaborator

@weited weited left a comment

Choose a reason for hiding this comment

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

Nice work

@weited weited merged commit 40f31a9 into main Aug 14, 2025
1 check passed
@weited weited deleted the add-elastic-search-pagination branch August 14, 2025 07:33
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.

3 participants