Skip to content

Index universe designations on every imported comic - #991

Merged
ajslater merged 1 commit into
developfrom
fix-universe-fts-designations
Oct 20, 2026
Merged

ajslater merged 1 commit into
developfrom
fix-universe-fts-designations

Conversation

@ajslater

Copy link
Copy Markdown
Owner

Problem

A full search rebuild (SearchIndexerSync) indexes each universe as its designation plus its name, e.g. 1,Alpha. The importer's inline writer took designations only from FTS_CREATED_M2MS, a map of universes created in the current import. That map was wrong in several ways, so a search for a designation missed many imported comics until the next full rebuild:

  • First comic only: the map entry was popped, so only the first comic linked to a new universe got the designation.
  • Whole-tuple key: it was keyed on the comic's whole tuple of universe names, so a comic with two universes got neither designation.
  • Existing universes: comics newly linked to a universe from an earlier import got none.
  • Kept universes: a comic whose universe set changed lost the designations of the universes it kept.
  • Chunks: it was assigned once per chunk, so comics in later chunks of a big import lost them.

Fix

At search-entry time, importer/search/update.py collects every universe name the pass indexes: new links plus kept links from FTS_EXISTING_M2MS. It looks them all up in one batched Universe query (name is unique) and adds the matching designations to each entry. That makes the inline path match what the full rebuild writes. FTS_CREATED_M2MS and the code that filled it are removed.

The FK re-sync for a universe whose designation changes (FTS_UPDATED_M2MS, fixed for chunking in #990) is unchanged.

Tests

tests/importer/test_universe_fts_designations.py covers a new universe shared by two comics, two universes on one comic, a link to an existing universe, a kept universe after adding another, and a later chunk with the chunk size forced to 1. All five fail before the fix and pass after.

test_basic, test_update_all and test_update_none no longer expect FTS_CREATED_M2MS. The link-stage snapshot now holds only universe names, and the final stored row still reads 4242,Young Adult Silly Universe.

make fix, make lint, make ty are clean, and the full make test passes (1740 Python, 1033 frontend). The NEWS line from #990 is folded into one.

🤖 Generated with Claude Code

The importer's inline search writer took designations only from a map of
universes created in this import. It popped each entry, so only the first
comic linked to a new universe got it; it keyed the map on a comic's whole
tuple of universe names, so a comic with two universes got none; it never
covered existing or kept universes; and it was replaced per chunk.

Look the designations up instead, one batched Universe query per search
pass over every universe name the pass indexes, new, existing or kept,
and drop the created-universes map.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ajslater
ajslater merged commit fc83dcf into develop Oct 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant