Skip to content

feat: Add Soundex phonetic matching for person name search#262

Open
isaacschepp wants to merge 47 commits intomainfrom
feat/phonetic-matching
Open

feat: Add Soundex phonetic matching for person name search#262
isaacschepp wants to merge 47 commits intomainfrom
feat/phonetic-matching

Conversation

@isaacschepp
Copy link
Copy Markdown
Collaborator

Summary

Add Soundex phonetic matching algorithm to the GLX library and CLI, enabling name searches that find spelling variants (Miller/Myller/Mueller, Johannes/Johannis, Smith/Smyth).

glx query persons --name "Miller" --phonetic --archive ./archive

Library (go-glx/phonetic.go)

  • Soundex() — NARA standard algorithm (letter + 3 digits)
  • SoundexMatch() — compare two names phonetically
  • PhoneticPersonSearch() — search all persons by Soundex code

CLI

  • --phonetic flag on glx query persons --name
  • Compares Soundex codes of each word in person names against the query

Test plan

  • 19 test cases: standard Soundex codes (Robert/Rupert, Ashcraft/Ashcroft, Tymczak, Pfister), genealogy-relevant pairs (Miller/Myller/Mueller, Johannes/Johannis/Johanns, Smith/Smyth, Webb/Wab), matching, person search, no-match, empty-query
  • Full test suite passes
  • go vet clean, build succeeds

Closes #115

Add Soundex algorithm (NARA standard) to go-glx library and integrate
as --phonetic flag on glx query persons --name. Matches names that
sound alike regardless of spelling (Miller/Myller/Mueller, Johannes/
Johannis/Johanns, Smith/Smyth).

Library (go-glx/phonetic.go):
- Soundex() — NARA algorithm, returns 4-char code
- SoundexMatch() — compare two names phonetically
- PhoneticPersonSearch() — search archive persons by Soundex

CLI (glx query persons --name X --phonetic):
- --phonetic flag enables Soundex matching on each word in person names
- Added to supported flags for persons entity type

19 test cases covering standard Soundex codes, matching, person search,
no-match, and empty-query edge cases.

Closes #115
@isaacschepp isaacschepp added cli CLI commands and flags go-glx Core Go library (go-glx package) labels Mar 29, 2026
Copilot AI review requested due to automatic review settings March 29, 2026 04:03
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 29, 2026

Deploying genealogix with  Cloudflare Pages  Cloudflare Pages

Latest commit: a3f2290
Status: ✅  Deploy successful!
Preview URL: https://375c714a.genealogix.pages.dev
Branch Preview URL: https://feat-phonetic-matching.genealogix.pages.dev

View logs

Copy link
Copy Markdown
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

Adds Soundex-based phonetic matching to the go-glx library and exposes it via a new --phonetic flag on glx query persons --name, enabling searches that match common spelling variants.

Changes:

  • Added Soundex implementation + helpers and a phonetic person search helper in go-glx.
  • Added unit tests covering Soundex codes, matching, and phonetic person search.
  • Added --phonetic flag wiring and phonetic filtering logic to the CLI query path.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
go-glx/phonetic.go Implements Soundex, SoundexMatch, and PhoneticPersonSearch.
go-glx/phonetic_test.go Adds test coverage for Soundex behavior and phonetic person search.
glx/query_runner.go Adds Phonetic option, validation allowance, and phonetic name filtering in queryPersons.
glx/cli_commands.go Adds --phonetic flag and passes it into query options.

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

- Restrict Soundex to ASCII A-Z only (prevents truncation of non-ASCII
  runes when stored as first byte of code)
- Add nil archive guard in PhoneticPersonSearch
- Validate --phonetic requires --name (error if used alone)
- Split multi-word queries and match any query word against any name
  word (fixes "Jane Miller" never matching)
- Note: CLI-level phonetic test deferred (library tests cover the logic)
@isaacschepp isaacschepp changed the title Add Soundex phonetic matching for person name search feat: Add Soundex phonetic matching for person name search Mar 29, 2026
Copilot AI review requested due to automatic review settings March 29, 2026 05:05
@isaacschepp isaacschepp review requested due to automatic review settings March 29, 2026 05:05
Copilot AI review requested due to automatic review settings March 29, 2026 13:42
@isaacschepp isaacschepp review requested due to automatic review settings March 29, 2026 13:42
Copilot AI review requested due to automatic review settings March 29, 2026 15:38
@isaacschepp isaacschepp review requested due to automatic review settings March 29, 2026 15:38
Copilot AI review requested due to automatic review settings March 29, 2026 15:42
@isaacschepp isaacschepp review requested due to automatic review settings March 29, 2026 15:42
Copilot AI review requested due to automatic review settings March 29, 2026 17:09
@isaacschepp isaacschepp review requested due to automatic review settings March 29, 2026 17:09
Copilot AI review requested due to automatic review settings March 29, 2026 17:34
@isaacschepp isaacschepp review requested due to automatic review settings March 29, 2026 17:34
@isaacschepp isaacschepp review requested due to automatic review settings April 1, 2026 03:28
Copilot AI review requested due to automatic review settings April 1, 2026 03:29
@isaacschepp isaacschepp review requested due to automatic review settings April 1, 2026 03:29
Copilot AI review requested due to automatic review settings April 1, 2026 21:09
@isaacschepp isaacschepp review requested due to automatic review settings April 1, 2026 21:09
Copilot AI review requested due to automatic review settings April 1, 2026 21:31
@isaacschepp isaacschepp review requested due to automatic review settings April 1, 2026 21:31
Copilot AI review requested due to automatic review settings April 1, 2026 22:29
@isaacschepp isaacschepp review requested due to automatic review settings April 1, 2026 22:29
Copilot AI review requested due to automatic review settings April 1, 2026 22:36
@isaacschepp isaacschepp review requested due to automatic review settings April 1, 2026 22:36
Copilot AI review requested due to automatic review settings April 2, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI commands and flags go-glx Core Go library (go-glx package)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phonetic name matching (Soundex/Metaphone) for person search

3 participants