From d2b43f188433c522a025d8524442104516e3c5bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Schl=C3=B6gl?= Date: Wed, 22 May 2024 16:47:21 +0200 Subject: [PATCH] fix: add notes field to index resolves #95 --- viecpro_typesense_detail/details/detail_court.py | 4 +++- viecpro_typesense_detail/details/detail_institution.py | 2 ++ viecpro_typesense_detail/details/detail_person.py | 2 ++ viecpro_typesense_detail/details/detail_place.py | 4 +++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/viecpro_typesense_detail/details/detail_court.py b/viecpro_typesense_detail/details/detail_court.py index 7518ac3..29e5b04 100644 --- a/viecpro_typesense_detail/details/detail_court.py +++ b/viecpro_typesense_detail/details/detail_court.py @@ -56,7 +56,8 @@ F("sources"), # TODO: give robin example of how to display sources, and format this accordingly F("personnel"), F("locations"), - F("hierarchy") + F("hierarchy"), + F("notes", type="string"), ] @@ -132,6 +133,7 @@ def main(offset:int=0) -> Dict[str, Any]: res["sources"] = get_references_for_instance(instance) res["ampel"] = ampel(instance) res["sameAs"] = [uri.uri for uri in instance.uri_set.all() if not uri.uri.startswith("https://viecpro.acdh.oeaw.ac.at")] + res["notes"] = instance.notes if instance.notes else "" results.append(res) diff --git a/viecpro_typesense_detail/details/detail_institution.py b/viecpro_typesense_detail/details/detail_institution.py index 43bc5c5..ae60146 100644 --- a/viecpro_typesense_detail/details/detail_institution.py +++ b/viecpro_typesense_detail/details/detail_institution.py @@ -26,6 +26,7 @@ F("personnel"), F("locations"), F("hierarchy"), + F("notes", type="string"), ] @@ -92,6 +93,7 @@ def main(offset: int = 0) -> Dict[str, Any]: res["sources"] = get_references_for_instance(instance) res["ampel"] = ampel(instance) res["sameAs"] = [uri.uri for uri in instance.uri_set.all() if not uri.uri.startswith("https://viecpro.acdh.oeaw.ac.at")] + res["notes"] = instance.notes if instance.notes else "" results.append(res) diff --git a/viecpro_typesense_detail/details/detail_person.py b/viecpro_typesense_detail/details/detail_person.py index 7b15cc6..4cc3083 100644 --- a/viecpro_typesense_detail/details/detail_person.py +++ b/viecpro_typesense_detail/details/detail_person.py @@ -53,6 +53,7 @@ # label_data and RelData Kirchliche Amtsbeziehung F("relations_to_church_and_orders"), F("non_court_functions"), # labelData other jobs + F("notes", type="string") #editorial notes ] # unused atm, we only build the person collection (for now) @@ -244,6 +245,7 @@ def main(offset: int = 0): for uri in instance.uri_set.all() if not uri.uri.startswith("https://viecpro.acdh.oeaw.ac.at") ] + res["notes"] = instance.notes if instance.notes else "" results.append(res) return {"schema": schema, "results": results} diff --git a/viecpro_typesense_detail/details/detail_place.py b/viecpro_typesense_detail/details/detail_place.py index d24a66d..306af69 100644 --- a/viecpro_typesense_detail/details/detail_place.py +++ b/viecpro_typesense_detail/details/detail_place.py @@ -18,7 +18,8 @@ F("alternative_names", type="string[]"), F("person_relations"), F("place_relations"), - F("institution_relations") + F("institution_relations"), + F("notes", type="string") # TODO: add all fields @@ -94,6 +95,7 @@ def main(offset:int=0) -> Dict[str, Any]: res["model"] = model.__name__ res["ampel"] = ampel(instance) res["sameAs"] = [uri.uri for uri in instance.uri_set.all() if not uri.uri.startswith("https://viecpro.acdh.oeaw.ac.at")] + res["notes"] = instance.notes if instance.notes else "" results.append(res) return {"schema":schema, "results":results}