Skip to content

Deduplicate multi-term Apple Notes search results by note ID #3

@vinitu

Description

@vinitu

Problem

When searching multiple terms separately, the same note can appear more than once. Example: a note named 📅 #timeline / Kia Cerato Koup matches both Kia and Cerato, so naive search can return duplicates.

Desired behavior

Search results should be deduplicated by Apple Notes id.

Example:

scripts/commands/search.sh Kia Cerato

Should return the Kia Cerato Koup note once, with both terms listed:

📅 #timeline / Kia Cerato Koup	...	MATCHED_TERMS=Kia,Cerato

Implementation notes

  • Keep a seenIds list in AppleScript, or deduplicate in shell after collecting results.
  • Prefer deduping by the stable id, not note name, because duplicate note titles are possible.
  • Preserve all matched terms for the note.

Acceptance criteria

  • A note matching 2+ search terms appears once.
  • Duplicate note titles with different IDs still appear as separate results.
  • Tests or documented manual verification cover the multi-term duplicate case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions