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

Convert bool filters to 0 or 1 when querying the search service #3202

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

magopian
Copy link
Contributor

Fixes #1456

Comment on lines +26 to +28
# This is needed or the test will fail if you have a search service configured in your udata.cfg file.
current_app.config["SEARCH_SERVICE_API_URL"] = ""

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 unrelated to this PR, but this test will fail if you have a search service configured, which I needed to fix this PR ;)

Comment on lines +56 to +57
# This is needed or the test will fail if you have a search service configured in your udata.cfg file.
current_app.config["SEARCH_SERVICE_API_URL"] = ""
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 unrelated to this PR, but this test will fail if you have a search service configured, which I needed to fix this PR ;)

@magopian magopian requested review from maudetes and bolinocroustibat and removed request for maudetes November 19, 2024 17:33
Copy link
Contributor

@maudetes maudetes left a comment

Choose a reason for hiding this comment

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

Thank you for this PR!
I think the multiplication of endpoints and API shows all the small consistencies issues sadly

# HACK: use the `.__class__.__name__` to avoid having to import `BoolFilter` here, as importing it at the top would make a import loop.
if self.adapter.filters[name].__class__.__name__ == "BoolFilter":
# The search service uses 1 and 0 for booleans.
param_value = 1 if value == "true" else 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Somehow on udata-search-service side, featured is not set to 0 or 1 but 1 or 4 (probably for poorly decided scoring reasons) 🥲

# HACK: use the `.__class__.__name__` to avoid having to import `BoolFilter` here, as importing it at the top would make a import loop.
if self.adapter.filters[name].__class__.__name__ == "BoolFilter":
# The search service uses 1 and 0 for booleans.
param_value = 1 if value == "true" else 0
Copy link
Contributor

Choose a reason for hiding this comment

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

I think if value is True and not true when it comes from the udata-front search view: /fr/datasets/

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

Successfully merging this pull request may close these issues.

Corriger le bug sur le paramètre featured
2 participants