Skip to content

Feat/search criteria and endangered filter#439

Merged
zigzagdev merged 14 commits into
mainfrom
feat/search-criteria-and-endangered-filter
May 4, 2026
Merged

Feat/search criteria and endangered filter#439
zigzagdev merged 14 commits into
mainfrom
feat/search-criteria-and-endangered-filter

Conversation

@zigzagdev
Copy link
Copy Markdown
Owner

No description provided.

zigzagdev and others added 14 commits May 2, 2026 22:43
Allow callers to request inscription-criteria filtering on heritage
search. The factory rejects values outside the i-x whitelist so invalid
input fails fast before reaching Algolia. Also updates the consuming
factory and search-heritages tests for the new constructor argument.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Without indexing the criteria attribute, any criteria facet filter
would always return zero hits because the field would not exist on
Algolia records.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Multiple selected criteria are joined with OR (criteria:i OR criteria:iv
...) so a request for "i or iv" returns heritage sites whose criteria
contain either value, matching the certification-exam study flow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Wire criteria through the application and presentation layers so
clients can pass criteria[]=i&criteria[]=iv on the search endpoint.
The controller normalises a single string value into a one-element
array for callers that send a non-array form.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Allow callers to filter heritage search by endangered status. The
factory only forwards the value because the ?bool type hint already
guards against unsupported inputs at the language level.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Translate the boolean isEndangered into a single Algolia facet
condition (is_endangered:true or is_endangered:false) so users can
narrow heritage search to the World Heritage in Danger list, matching
a common certification-exam study flow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ller

Wire isEndangered through the application and presentation layers so
clients can pass is_endangered=true|false on the search endpoint. The
controller distinguishes "absent" from "false" by checking presence
before reading the boolean, so omitting the parameter preserves the
existing all-records behaviour.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The split-json command was silently dropping the raw UNESCO 'danger'
field, so every imported site ended up with is_endangered=false in
MySQL and Algolia. The new is_endangered facet filter would have
returned zero hits in production for that reason.

Read row['danger'] in normalizeSiteRowImportReady, OR-merge it across
duplicate rows in mergeSiteRowPreferExisting (so any row carrying
danger:true wins), and add a boolFromDanger helper that accepts
boolean and string forms ("True", "true", "1", "yes") UNESCO emits.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Ship the 1248 Japanese short descriptions as a slim 898 KB JSON so the
translate command can restore them on production without paying for
Google Translate API. Extracted from the local 19 MB
world_heritage_sites_translation.json (kept untracked as working
state) by stripping every field except id_no and short_description_ja.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Point the --from-json branch of the translate command at the
checked-in 898 KB short_description_ja.json instead of the local
19 MB world_heritage_sites_translation.json. Behaviour is unchanged
because description_ja was already null for every record in the full
file; the slim file just trims fields that were never used and ships
the cache to production.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Commit the 19 MB UNESCO snapshot with spliced Japanese translations so
the file is available on the production host without re-running the
local dump. Used as the working backup that the translate command
writes back to; the slim short_description_ja.json remains the
canonical --from-json source.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The frontend serialises multi-select criteria as criteria=i,ii,iii,iv
(comma-separated). The previous single-string fallback wrapped the
whole string in a one-element array, making it fail the i-x whitelist
validation in AlgoliaSearchListQueryFactory. Split on comma so each
code is validated and forwarded to the Algolia OR filter individually.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…algolia

`is endangered` filter search algolia
Copy link
Copy Markdown
Owner Author

@zigzagdev zigzagdev left a comment

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 76968dc into main May 4, 2026
25 checks passed
@zigzagdev zigzagdev deleted the feat/search-criteria-and-endangered-filter branch May 4, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: search filter expansion — criteria & is_endangered / 検索フィルタ拡張(登録基準・危機遺産)

1 participant