Skip to content

Commit

Permalink
fix: hofstaat, remove facet from owners and add kategorie
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Feb 22, 2024
1 parent fe0a84f commit 07734cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion viecpro_typesense/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ def labelhandler(x):
return [label.label for label in labels if label.label_type.name in label_types]


def kategorienhandler(x):
labels = x.label_set.all()
return [label.label for label in labels if label.label_type.name == "Kategorie"]


def create_entity_collections():
res = []
for m in AbstractEntity.get_all_entity_classes():
Expand Down Expand Up @@ -204,7 +209,8 @@ def queryset(): return Institution.objects.filter(kind__name="Hofstaat")
# Maybe need to change model to hofstaat here
model = StaticField(value="Hofstaat", options=O(facet=True))
kind = KindField("kind", options=O(facet=True))
labels = LabelsNestedObjectField("id", pass_instance=True)
labels = LabelsNestedObjectField("id", pass_instance=True, options=O(facet=False))
kategorie = Field("kategorie", options=O(type="string[]", facet=True, optional=True), handler=kategorienhandler, pass_instance=True)


def unified_fields(m): return {
Expand Down
4 changes: 2 additions & 2 deletions viecpro_typesense/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

class MainOwnerField(Field):
class Config:
options = O(type="object", optional=True, facet=True)
options = O(type="object", optional=True, facet=False)
handler = MainOwnerFieldHandler


class HofstaatsinhaberField(Field):
class Config:
options = O(type="object[]", optional=True, facet=True)
options = O(type="object[]", optional=True, facet=False)
handler = HofstaatsinhaberHandler


Expand Down

0 comments on commit 07734cf

Please sign in to comment.