Skip to content

fix: resolve Algolia search adapter design gaps (keyword/country filtering, index settings as code, non-numeric id handling) / Algolia検索Adapterの設計課題を解消(キーワード/国名フィルタ、インデックス設定のコード化、非数値ID対応) - #608

Merged
zigzagdev merged 16 commits into
mainfrom
fix/algolia-search-adapter-design-gaps
Oct 26, 2026

Conversation

@zigzagdev

Copy link
Copy Markdown
Owner

Motivation / 目的

A design-gap audit of AlgoliaWorldHeritageSearchAdapter surfaced several real correctness and maintainability issues (tracked under parent Issue #592). This PR brings together the fixes landed on the fix/algolia-search-adapter-design-gaps branch so far.

AlgoliaWorldHeritageSearchAdapterの設計レビュー(親Issue #592)で、いくつかの実際の正確性・保守性の問題が見つかりました。

What I have done / 実施内容

…lter

fix: keep keyword search intact when countryIso3 resolves / countryIso3解決時にkeywordを破棄しない
The countryName branch (reached only when countryIso3 did not resolve)
added its OR-filter to the mandatory $filters array, so an input that
doesn't match a real country (e.g. "Jap") excluded every record instead
of falling back to full-text search, even though the surrounding comment
said the opposite was intended.

Move it to $optionalFilters, which boosts matching records instead of
excluding non-matching ones, and extend the empty-result guardrail to
also treat a non-empty $optionalFilters as real search criteria.
…ageSearchAdapterTest

- country-name-only search now expects optionalFilters, not filters
- lowercase country name still builds the optional OR-filter
- an unresolvable country term (e.g. a 3-letter non-country word) no
  longer short-circuits to an empty result via the adapter's own
  guardrail
…nal-filter

fix: use optionalFilters for unresolved countryName in Algolia search / 未解決countryNameをoptionalFiltersに変更
feat: manage Algolia attributesForFaceting as code / Algoliaのattributesforfacetingをコードで管理
…dling

fix: do not silently drop non-numeric Algolia hit ids / 非数値IDのサイレントドロップを防ぐ
@zigzagdev zigzagdev self-assigned this Oct 26, 2026
@github-actions github-actions Bot added bug Something isn't working backend release labels Oct 26, 2026
@zigzagdev zigzagdev linked an issue Oct 26, 2026 that may be closed by this pull request
1 of 10 tasks
@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.20635% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.19%. Comparing base (8c21d00) to head (287b1ec).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...tage/Adapter/AlgoliaWorldHeritageSearchAdapter.php 94.11% 1 Missing ⚠️
src/app/Providers/AppServiceProvider.php 66.66% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #608      +/-   ##
============================================
+ Coverage     67.35%   68.19%   +0.84%     
- Complexity     1708     1733      +25     
============================================
  Files           149      153       +4     
  Lines          8965     9202     +237     
============================================
+ Hits           6038     6275     +237     
  Misses         2927     2927              
Files with missing lines Coverage Δ
.../app/Console/Commands/AlgoliaSyncIndexSettings.php 100.00% <100.00%> (ø)
...rldHeritage/Adapter/AlgoliaIndexSettingsSyncer.php 100.00% <100.00%> (ø)
...dHeritage/Tests/AlgoliaIndexSettingsSyncerTest.php 100.00% <100.00%> (ø)
...rldHeritage/Tests/AlgoliaSyncIndexSettingsTest.php 100.00% <100.00%> (ø)
...ge/Tests/AlgoliaWorldHeritageSearchAdapterTest.php 100.00% <100.00%> (ø)
...tage/Adapter/AlgoliaWorldHeritageSearchAdapter.php 87.23% <94.11%> (+2.52%) ⬆️
src/app/Providers/AppServiceProvider.php 37.50% <66.66%> (+4.16%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zigzagdev zigzagdev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

LGTM

@zigzagdev
zigzagdev merged commit 48b642b into main Oct 26, 2026
28 checks passed
@zigzagdev
zigzagdev deleted the fix/algolia-search-adapter-design-gaps branch October 26, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend bug Something isn't working release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

検索 Adapter の挙動が設計意図と乖離している箇所の整理

1 participant