Skip to content

Improve ResultData candidate deduplication#105

Merged
cyanzhong merged 8 commits intomainfrom
copilot/fix-duplicate-data-handling
Feb 21, 2026
Merged

Improve ResultData candidate deduplication#105
cyanzhong merged 8 commits intomainfrom
copilot/fix-duplicate-data-handling

Conversation

Copy link
Contributor

Copilot AI commented Feb 21, 2026

  • Fix ResultData.init(candidates:) to prefer candidates with better kind (.phoneNumber or .link) over .text when deduplicating
  • Rename existingIndex to index for concise naming
  • Expand guard statement to use line breaks
  • Add blank line after guard block and split multi-condition if onto separate lines
  • Rename result to results (plural, since it's a collection)

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix duplication handling in ResultData.init Prefer detected kind over .text when deduplicating ResultData candidates Feb 21, 2026
Copilot AI requested a review from cyanzhong February 21, 2026 11:03
Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com>
Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com>
Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com>
Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com>
@cyanzhong cyanzhong marked this pull request as ready for review February 21, 2026 12:05
@cyanzhong cyanzhong requested a review from Copilot February 21, 2026 12:05
@cyanzhong
Copy link
Contributor

@copilot use a concise PR title.

Copy link
Contributor Author

Copilot AI commented Feb 21, 2026

@copilot use a concise PR title.

I don't have the ability to update the PR title directly. A suggested concise title: "Improve ResultData candidate deduplication".

@cyanzhong cyanzhong changed the title Prefer detected kind over .text when deduplicating ResultData candidates Improve ResultData candidate deduplication Feb 21, 2026
Copy link
Contributor

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 the ResultData deduplication logic to improve code organization and aims to prefer detected kinds (phoneNumber, link) over plain text when handling duplicate text values. The refactoring replaces a Set-based filter approach with an explicit loop that tracks seen text values using a dictionary mapping to indices.

Changes:

  • Refactored deduplication logic from Set-based filtering to explicit loop with index tracking
  • Changed data structure from Set<String> to [String: Int] dictionary for duplicate detection
  • Renamed variables for clarity (existingIndex→index, result→results)

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

@cyanzhong cyanzhong requested a review from Copilot February 21, 2026 12:11
Copy link
Contributor

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


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

@cyanzhong cyanzhong merged commit 1d528f5 into main Feb 21, 2026
5 checks passed
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