Skip to content

Commit

Permalink
fix: rename gender values to german
Browse files Browse the repository at this point in the history
Closes: #24
  • Loading branch information
b1rger committed Feb 21, 2024
1 parent c2f5c6b commit 67a485d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion viecpro_typesense/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ def get_entity_specific_detail_fields(entity):
return fields


def genderhandler(x):
match getattr(x, "gender", None):
case "male": return "männlich"
case "female": return "weiblich"
case _: return "unbekannt"


def create_entity_collections():
res = []
for m in AbstractEntity.get_all_entity_classes():
Expand Down Expand Up @@ -97,7 +104,7 @@ def create_entity_collections():
per_fields = {
"first_name": StringField("first_name", options=O(sort=True)),
"fullname": FullNameField(("name", "first_name"), options=O(sort=True)),
"gender": StringField("gender", options=O(facet=True, optional=True, type="string")),
"gender": StringField("gender", pass_instance=True, handler=genderhandler, options=O(facet=True, optional=True, type="string")),
"titles": TitlesNestedObjectField("id", pass_instance=True),
"functions": FunctionsArrayField("id", pass_instance=True, options=O(facet=True)),# TODO: need to remove need to pass field param to field with pass_instance. id won't be accessed here, its a dummy
"institutions": PersonInstitutionArrayField("id", pass_instance=True, options=O(facet=True)),
Expand Down

0 comments on commit 67a485d

Please sign in to comment.