Skip to content

Commit

Permalink
Adds directory id to fts index
Browse files Browse the repository at this point in the history
  • Loading branch information
Tschuppi81 committed Nov 22, 2023
1 parent ccc6c0c commit eae5dcd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/onegov/directory/models/directory_entry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from sqlalchemy.ext.hybrid import hybrid_property

from onegov.core.orm import Base
from onegov.core.orm.mixins import ContentMixin
from onegov.core.orm.mixins import TimestampMixin
Expand All @@ -8,12 +6,13 @@
from onegov.file import AssociatedFiles
from onegov.gis import CoordinatesMixin
from onegov.search import SearchableContent
from sqlalchemy import Column
from sqlalchemy import Column, cast
from sqlalchemy import ForeignKey
from sqlalchemy import Index
from sqlalchemy import Text
from sqlalchemy.dialects.postgresql import HSTORE
from sqlalchemy.ext.mutable import MutableDict
from sqlalchemy.ext.hybrid import hybrid_property
from uuid import uuid4


Expand All @@ -27,7 +26,7 @@ class DirectoryEntry(Base, ContentMixin, CoordinatesMixin, TimestampMixin,
'keywords': {'type': 'keyword'},
'title': {'type': 'localized'},
'lead': {'type': 'localized'},
'directory_id': {'type': 'keyword'},
'_directory_id': {'type': 'keyword'},

# since the searchable text might include html, we remove it
# even if there's no html -> possibly decreasing the search
Expand Down Expand Up @@ -88,6 +87,10 @@ def external_link_title(self):
def external_link_visible(self):
return self.directory.configuration.link_visible

@hybrid_property
def _directory_id(self):
return cast(self.directory_id, Text)

@property
def directory_name(self):
return self.directory.name
Expand Down

0 comments on commit eae5dcd

Please sign in to comment.