Places as a gazetteer, role_places, teaser and three seniority sources
Migration 19 adds places, place_aliases, place_includes (seeded from the dictionaries in app/models.py and app/places.py, Europe as a continent over the European countries) and role_places, one row per place of a role, resolved by app.places.Gazetteer, NULL when unknown. upsert_role writes them from raw["places"], else the place line cut at ";"; the migration builds them from each role's place column. The Place filter and the country and place gates are joins over the tree: country:DK is any place under Denmark, region:skane any town in Skane, a country gate is met by any place in its countries, and the EU fallback of the word matcher is no longer used. A place: token the gazetteer does not know still matches whole words. Store gains gazetteer, role_places, unresolved_places, add_place_alias, add_place and relink_places. roles.teaser is kept-filled and embedded while there is no description; a vector is dropped when a better text arrives. seniority_model, _stated and _title sit behind roles.seniority, which stays the first filled of them. TRUSTED_POSTED_HOSTS gives way to trusted_posted(host), which reads READS.fields.posted and falls back to the old set for undeclared readers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4c0da58da7
commit
bbd7522163
10 files changed
+1437
-98
No files matched your search
@@ -164,13 +164,17 @@ def test_a_v17_file_gains_dup_of_with_its_first_rebuild(tmp_path: Path) -> None:
|
||||
store.upsert_role(item)
|
||||
store.put_vectors("m", [(first.uid, np.ones(3, dtype=np.float32))])
|
||||
with sqlite3.connect(path) as conn:
|
||||
for table in ("role_places", "place_includes", "place_aliases", "places"):
|
||||
conn.execute(f"DROP TABLE {table}")
|
||||
for column in ("teaser", "seniority_model", "seniority_stated", "seniority_title"):
|
||||
conn.execute(f"ALTER TABLE roles DROP COLUMN {column}")
|
||||
conn.execute("DROP INDEX idx_roles_dup_of")
|
||||
conn.execute("ALTER TABLE roles DROP COLUMN dup_of")
|
||||
conn.execute("PRAGMA user_version = 17")
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [18]
|
||||
assert migrated.migrations_applied == [18, 19]
|
||||
assert dup_of(migrated) == {first.uid: None, second.uid: first.uid}
|
||||
with sqlite3.connect(path) as conn:
|
||||
assert conn.execute("SELECT 1 FROM sqlite_master WHERE name = 'idx_roles_dup_of'"
|
||||
|
||||
Reference in new issue
Block a user