Repository navigation
fix: do not silently drop non-numeric Algolia hit ids / 非数値IDのサイレントドロップを防ぐ - #604
Merged
zigzagdev merged 2 commits intoOct 26, 2026
Conversation
2 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix/algolia-search-adapter-design-gaps #604 +/- ##
============================================================================
+ Coverage 68.05% 68.19% +0.13%
- Complexity 1731 1733 +2
============================================================================
Files 153 153
Lines 9159 9202 +43
============================================================================
+ Hits 6233 6275 +42
- Misses 2926 2927 +1
🚀 New features to boost your workflow:
|
zigzagdev
merged commit Oct 26, 2026
287b1ec
into
fix/algolia-search-adapter-design-gaps
28 checks passed
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation / 目的
AlgoliaWorldHeritageSearchAdapter::search()extracted ids with(int) $h['id']inside
array_map, then ran the result througharray_filter. A non-numericid/objectIDcasts to0, whicharray_filter's default truthy check thensilently removes. A data inconsistency on the Algolia side (e.g. a corrupted or
non-numeric id) would disappear from search results with no error or log trace.
AlgoliaWorldHeritageSearchAdapter::search()はarray_map内で(int) $h['id']を使ってIDを抽出し、その結果を
array_filterに通していました。非数値のid/objectIDは0にキャストされ、
array_filterのデフォルトのtruthy判定によって黙って除外されます。Algolia側のデータ不整合(壊れた、または非数値のid)があった場合、エラーもログも出さずに検索結果から消えて
いました。
What I have done / 実施内容
array_map/array_filterchain with an explicit loop thatchecks
is_numeric()before castingLog::warning()with both the rawidandobjectID, then skips just that hit (the rest of the results still return)AlgoliaWorldHeritageSearchAdapterTest's base class from plainPHPUnit
TestCaseto Laravel'sTests\TestCaseso theLogfacade can beasserted on; existing tests are unaffected by this
Test Results / テスト結果
AlgoliaWorldHeritageSearchAdapterTest: 6 passedphp artisan test(full suite): 227 passed, no regressionsCloses #600
Part of #592