fix: use stable search catalog codes

This commit is contained in:
2026-08-25 08:26:48 +03:00
parent 0ef6ad4d20
commit 2ef33c5cc3
6 changed files with 78 additions and 37 deletions

View File

@@ -15,6 +15,8 @@ import urllib.request
from pathlib import Path
from typing import Iterator
from search.catalog import authority_codes, source_code
APP_VERSION = "0.7.1"
LANGUAGES = {"ru", "ky"}
DEFAULT_MAPPING = Path(__file__).with_name("minjust-fragments-index.json")
@@ -73,12 +75,15 @@ def search_document(document: dict, fragment: dict, expected: tuple[str, str, st
"document_name_ky": localized(document.get("name"), "ky"),
"document_type_ru": localized(document.get("type"), "ru"),
"document_type_ky": localized(document.get("type"), "ky"),
"document_type_code": source_code("document_type", document.get("type")),
"status_ru": localized(document.get("status"), "ru"),
"status_ky": localized(document.get("status"), "ky"),
"status_code": source_code("status", document.get("status")),
"number": document.get("number"),
"date_adopted": dates.get("DateAdopted"),
"authority_paths_ru": paths(document, "authority_paths", "ru"),
"authority_paths_ky": paths(document, "authority_paths", "ky"),
"authority_codes": authority_codes(document.get("authority_paths", [])),
"source_path": fragment["source_path"],
"source_sha256": fragment["source_sha256"],
"text_sha256": fragment["text_sha256"],