Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ogc 508 replace elastic search by postgres v2 #1357

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

Tschuppi81
Copy link
Contributor

Please fill in the commit message below and work through the checklist. You can delete parts that are not needed, e.g. the optional description, the link to a ticket or irrelevant options of the checklist.

Commit message

:

TYPE: <Feature|Bugfix>
LINK:
HINT:

Checklist

  • I have performed a self-review of my code
  • I considered adding a reviewer
  • I have added an upgrade hint such as data migration commands to be run
  • I have updated the PO files
  • I have added new modules to the docs
  • I made changes/features for both org and town6
  • I have updated the election_day API docs
  • I have tested my code thoroughly by hand
    • I have tested styling changes/features on different browsers
    • I have tested javascript changes/features on different browsers
    • I have tested database upgrades
    • I have tested sending mails
    • I have tested building the documentation
  • I have added tests for my changes/features
    • I am using freezegun for tests depending on date and times
    • I considered using browser tests für javascript changes/features
    • I have added/updated jest tests for d3rendering (election_day, swissvotes)

Copy link

linear bot commented Jun 5, 2024

Copy link

codecov bot commented Jun 6, 2024

Codecov Report

Attention: Patch coverage is 44.65116% with 119 lines in your changes missing coverage. Please review.

Project coverage is 88.80%. Comparing base (b7b0849) to head (57f1ea4).
Report is 3 commits behind head on master.

Files Patch % Lines
src/onegov/org/models/search.py 28.00% 90 Missing ⚠️
src/onegov/org/views/search.py 22.72% 17 Missing ⚠️
src/onegov/agency/views/search.py 50.00% 4 Missing ⚠️
src/onegov/fsi/views/search.py 77.77% 2 Missing ⚠️
src/onegov/org/layout.py 60.00% 2 Missing ⚠️
src/onegov/landsgemeinde/views/search.py 80.00% 1 Missing ⚠️
src/onegov/org/path.py 75.00% 1 Missing ⚠️
src/onegov/search/cli.py 0.00% 1 Missing ⚠️
src/onegov/town6/views/search.py 83.33% 1 Missing ⚠️
Additional details and impacted files
Files Coverage Δ
src/onegov/directory/models/directory_entry.py 97.01% <100.00%> (+1.77%) ⬆️
src/onegov/onboarding/app.py 100.00% <100.00%> (ø)
src/onegov/onboarding/models/town_assistant.py 93.47% <100.00%> (ø)
src/onegov/org/app.py 97.56% <100.00%> (ø)
src/onegov/org/models/__init__.py 100.00% <100.00%> (ø)
src/onegov/org/models/ticket.py 88.55% <100.00%> (+0.06%) ⬆️
src/onegov/people/models/person.py 94.35% <100.00%> (+0.04%) ⬆️
src/onegov/search/__init__.py 100.00% <100.00%> (ø)
src/onegov/search/integration.py 85.63% <100.00%> (-0.74%) ⬇️
src/onegov/search/mixins.py 98.55% <ø> (-0.03%) ⬇️
... and 11 more

... and 23 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7b0849...57f1ea4. Read the comment docs.

@@ -67,6 +71,9 @@ def reference(self, request: 'OrgRequest') -> str:
def reference_group(self, request: 'OrgRequest') -> str:
return request.translate(self.group)

# FIXME: extra localized text is used for suggestions in the search but
# does not work with the ranking of the search results
# @hybrid_property
@cached_property
def extra_localized_text(self) -> str:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra_localized_text is used for search suggestions but do not work when applying the ranking for search results. I changed to hybrid_property which throws

  File "/home/reto/workspace/onegov-cloud/src/onegov/org/models/ticket.py", line 93, in extra_localized_text
    q = object_session(self).query(Message)
        ^^^^^^^^^^^^^^^^^^^^
  File "/home/reto/workspace/onegov-cloud/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 3464, in object_session
    util.raise_(
  File "/home/reto/workspace/onegov-cloud/venv/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
sqlalchemy.orm.exc.UnmappedInstanceError: Class 'sqlalchemy.ext.declarative.api.DeclarativeMeta' is not mapped; was a class (onegov.org.models.ticket.FormSubmissionTicket) supplied where an instance was required?

How can I transform it to a hybrid property?

)
# FIXME: sorting by rank_expression does not work
# with OrgTicketMixin::extra_localized_text
# query = query.order_by(rank_expression.desc())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the counter part of the issue described in the above comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant