Skip to content

Conversation

@tang-hi
Copy link
Contributor

@tang-hi tang-hi commented Nov 24, 2025

A minor code cleanup

refactored the loop over fieldHash in the flush method to use a for-each loop

Copilot AI review requested due to automatic review settings November 24, 2025 15:36
Copilot finished reviewing on behalf of tang-hi November 24, 2025 15:37
Copy link

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 refactors a loop over the fieldHash array in the flush method from an indexed for-loop to a for-each loop, making the code more concise and idiomatic.

Key changes:

  • Replaced indexed for-loop with for-each loop for iterating over fieldHash array

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Map<String, TermsHashPerField> fieldsToFlush = new HashMap<>();
for (int i = 0; i < fieldHash.length; i++) {
PerField perField = fieldHash[i];
for (PerField perField : fieldHash) {
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

While this refactoring is valid, there are other identical loop patterns over fieldHash in the same file (e.g., in writePoints() at line 371 and writeDocValues() at line 409) that still use the indexed for-loop style. For consistency, consider refactoring those loops to use for-each as well, or keep all of them in the same style.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant