Skip to content

is endangered filter search algolia#438

Merged
zigzagdev merged 8 commits into
feat/search-criteria-and-endangered-filterfrom
feat/add-is-endangered-filter-algolia
May 4, 2026
Merged

is endangered filter search algolia#438
zigzagdev merged 8 commits into
feat/search-criteria-and-endangered-filterfrom
feat/add-is-endangered-filter-algolia

Conversation

@zigzagdev

Copy link
Copy Markdown
Owner

No description provided.

zigzagdev and others added 8 commits May 3, 2026 09:55
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>
@zigzagdev zigzagdev self-assigned this May 4, 2026
@zigzagdev zigzagdev linked an issue May 4, 2026 that may be closed by this pull request
8 tasks

@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 ecd2285 into feat/search-criteria-and-endangered-filter May 4, 2026
25 checks passed
@zigzagdev zigzagdev deleted the feat/add-is-endangered-filter-algolia branch May 4, 2026 02:16
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: add is_endangered filter to Algolia search

1 participant