Skip to content

Sync upstream: derive LocationType from the primary Google type for keyword searches - #4

Merged
timwangmusic merged 3 commits into
mainfrom
sync/upstream-452
Aug 12, 2026
Merged

Sync upstream: derive LocationType from the primary Google type for keyword searches#4
timwangmusic merged 3 commits into
mainfrom
sync/upstream-452

Conversation

@timwangmusic

@timwangmusic timwangmusic commented Aug 12, 2026

Copy link
Copy Markdown

Brings timwangmusic/Vacation-Planner#452 down into this fork. upstream/master was exactly two commits ahead of main — that PR's change and its merge commit — so this closes the whole gap.

What it fixes

Keyword (brand) searches query Google with LocationTypeAny, so parsePlacesSearchResponse stamped every result with an empty LocationType. The write path is a blind upsert into the shared placeDetails:{id} records that category reads hydrate from, so each brand search wiped the type off previously typed records. A McDonald's cached by an Eatery search was then served with no type, and OfferBee's best-card scoring gave it the base rate instead of dining.

The fix derives LocationType from POI.PrimaryLocationType(place.Types) when the searched type is LocationTypeAny, reusing the machinery ReclassifyForCategory already applies on category reads. Typed searches keep their searched-type stamp.

Touches iowrappers/nearby_search.go and iowrappers/nearby_search_test.go only — 83 insertions, no deletions.

Why a merge rather than a cherry-pick

This preserves upstream's SHAs. Cherry-picking would give the same change a new SHA here, and every later origin/main..upstream/master comparison would keep reporting b28a678 as missing.

No conflicts: this fork's commits ahead of upstream are the Apple Maps SDK (#1) and the CI workflow change (#2), which touch applemaps/, .github/workflows/, and docs — no overlap with the merged files.

Verification

go build ./... && go vet ./... && go test ./... clean, including the 72 lines of new tests the upstream commit brings.

🤖 Generated with Claude Code

https://claude.ai/code/session_015WGSuRPA8YK814rwbCpStj

Summary by CodeRabbit

  • Bug Fixes
    • Improved place classification for brand and keyword searches by assigning more accurate location types.
    • Preserved saved location types when current search results do not provide one.
    • Prevented cached data from replacing a newer, more specific location type.

tim-eternos and others added 3 commits August 11, 2026 22:33
Keyword (brand) searches query Google with LocationTypeAny, so
parsePlacesSearchResponse stamped every result with LocationType "".
The write path is a blind upsert into the shared placeDetails:{id}
records that category reads hydrate from, so each brand search wiped
the type off previously typed records — a McDonald's cached by an
Eatery search was then served with no type, and downstream consumers
(OfferBee best-card) scored it at base rate instead of dining.

Two changes, both gap-filling only:

- parsePlacesSearchResponse: when the searched type is LocationTypeAny,
  derive LocationType from POI.PrimaryLocationType(place.Types) — the
  same machinery ReclassifyForCategory already uses on category reads.
  Typed searches keep their searched-type stamp.
- restoreCachedDetails: restore the stored LocationType when the
  rebuilt record has none, same "fill a gap, never overwrite" rule as
  URL/Summary/Address/Hours.

Existing blank-typed records stay blank until a fresh search rewrites
them; this stops new wipes and types new keyword results at the source.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BmBJ2x6b7V36vywSMrYDy
…rch-location-type

Derive LocationType from the primary Google type for keyword searches
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 481bf076-17ae-43d7-9100-90213e5c35e1

📥 Commits

Reviewing files that changed from the base of the PR and between 7c5528e and 7cc6330.

📒 Files selected for processing (2)
  • iowrappers/nearby_search.go
  • iowrappers/nearby_search_test.go

📝 Walkthrough

Walkthrough

Search results now derive meaningful location types for brand searches. Cached location types restore only missing values. Tests cover derivation, typed searches, untyped results, and preservation of fresh types.

Changes

Location type handling

Layer / File(s) Summary
Search result type derivation
iowrappers/nearby_search.go, iowrappers/nearby_search_test.go
Brand searches assign each place’s primary Google location type. Typed searches retain the searched type. Untyped results remain LocationTypeAny.
Cached location type restoration
iowrappers/nearby_search.go, iowrappers/nearby_search_test.go
Cached location types fill results with LocationTypeAny and do not overwrite fresh location types.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: tim-eternos

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: deriving LocationType from the primary Google type for keyword searches.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/upstream-452

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@timwangmusic
timwangmusic requested a review from Ronnie434 August 12, 2026 05:44
@timwangmusic
timwangmusic merged commit f382499 into main Aug 12, 2026
3 checks passed
@timwangmusic
timwangmusic deleted the sync/upstream-452 branch August 12, 2026 05:45
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