Repository navigation
fix: use optionalFilters for unresolved countryName in Algolia search / 未解決countryNameをoptionalFiltersに変更 - #602
Merged
zigzagdev merged 2 commits intoOct 24, 2026
Conversation
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
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix/algolia-search-adapter-design-gaps #602 +/- ##
============================================================================
+ Coverage 67.47% 67.75% +0.28%
- Complexity 1709 1713 +4
============================================================================
Files 149 149
Lines 8999 9072 +73
============================================================================
+ Hits 6072 6147 +75
+ Misses 2927 2925 -2
🚀 New features to boost your workflow:
|
4 tasks
zigzagdev
merged commit Oct 24, 2026
2988b89
into
fix/algolia-search-adapter-design-gaps
28 checks passed
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 / 目的
The countryName branch (reached only when countryIso3 did not resolve)
added its country OR-filter to the mandatory
$filtersarray. Because$filtersentries are AND-ed together, an input that doesn't match areal country (e.g. "Jap") excluded every record and returned 0 results,
even though the surrounding comment said the opposite was intended
("full-text search should still work for an unresolved country term").
countryName分岐(countryIso3が解決できなかった場合のみ到達)が、国名の
OR-filterを必須の
$filters配列に追加していました。$filtersはAND結合されるため、実在しない国名(例: "Jap")を渡すと全件が除外されて0件に
なっていました。コメントには「解決できない国名でも全文検索は動く」と
書かれていましたが、実装はそれを実現していませんでした。
What I have done / 実施内容
$optionalFilters, which boosts matching records instead ofexcluding non-matching ones
buildCountryOrFilter()result from$filters[]to$optionalFilters[]'optionalFilters' => $optionalFiltersto thesearchSingleIndex()call
$optionalFiltersas real search criteria (otherwise a country-name-onlyquery with no keyword would incorrectly short-circuit to 0 results)
optionalFiltersinstead of
filters, and added two new testsTest Results / テスト結果
AlgoliaWorldHeritageSearchAdapterTest: 5 passedphp artisan test(full suite): 220 passed, no regressionsCloses #595
Part of #592