Skip to content

Trigger the term_info fallback on a document with no term_info field - #112

Merged
Robbie1977 merged 1 commit into
mainfrom
fix/term-info-fallback-partial-doc
Sep 5, 2026
Merged

Trigger the term_info fallback on a document with no term_info field#112
Robbie1977 merged 1 commit into
mainfrom
fix/term-info-fallback-partial-doc

Conversation

@Robbie1977

Copy link
Copy Markdown
Contributor

What

get_term_info only rebuilt a term_info document when SOLR returned no document at all (hits == 0). But the vfb_json collection is written by several independent indexers, each setting only its own field via an atomic update — so a record that one of the query-result indexers (e.g. all_datasets_query) reaches before the term_info indexer does has a document with no term_info field in it. For such an id, term_info_parse_object hit a KeyError and get_term_info returned None; the fallback never ran because it was keyed on the hit count, not on whether the field existed.

Berg2025a and Bates2026 were exactly that on 2026-09-04: listed under All Datasets (thumbnail and all — all_datasets_query present), but the term-info panel on the site was blank (get_term_info -> null).

Fix

Add _has_term_info_document, which checks the term_info field itself rather than the hit count, and key the fallback trigger in get_term_info on that instead of hits. The rebuilt document is written with the indexer's own atomic-update shape, so sibling fields already on a partial document are left as they were.

Testing

New src/test/test_term_info_fallback_partial_doc.py (8 tests, offline — SOLR and the PDB rebuild are stubbed): pins the trigger logic (no document / document without term_info / empty term_info field / real term_info / the fallback's own stand-in result), and exercises get_term_info end to end for the rebuild-on-partial-doc case, the leave-alone-when-present case, and the rebuild-fails-gracefully case.

All 45 tests in the suite pass with the fix; reverting the trigger change alone causes 6 of the new tests to fail, confirming they pin the right behavior.

Related: VirtualFlyBrain/VFB_json_schema_indexer#6 (the indexer-side fix for the same underlying gap — the missing-phase-skip bug that let this go undetected for over a day).

get_term_info only rebuilt a term_info document when SOLR returned no
document at all (hits == 0). But the vfb_json collection is written by
several indexers, each setting only its own field with an atomic update,
so a record that one of the query-result indexers reaches before the
term_info indexer does has a document with no term_info in it. For such
an id term_info_parse_object hit a KeyError and get_term_info returned
None, and the fallback never ran.

Berg2025a and Bates2026 were exactly that on 2026-09-04: all_datasets_query
present (listed under All Datasets, thumbnail and all), term_info absent
(blank term-info panel on the site, get_term_info -> null).

Key the fallback on the field rather than the hit count. The rebuilt
document is written with the indexer's atomic-update shape, so the
sibling fields on a partial document are left as they were.
@Robbie1977
Robbie1977 merged commit 6b5601f into main Sep 5, 2026
3 of 5 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.

2 participants