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
Optimize indexation #1215
Optimize indexation #1215
Conversation
CHANGELOG.md
Outdated
@@ -22,6 +22,7 @@ | |||
- Switch from static theme avatars/placeholders to [identicons](https://en.wikipedia.org/wiki/Identicon) for readability (mostly on discussions) [#1193](https://github.com/opendatateam/udata/pull/1193) | |||
- Fix the scroll to a discussion sub-thread [#1206](https://github.com/opendatateam/udata/pull/1206) | |||
- Fix duplication in discussions [migration] [#1209](https://github.com/opendatateam/udata/pull/1209) | |||
- Optimize a little bit indexation [#1215](https://github.com/opendatateam/udata/pull/1215) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*Optimize indexation a little bit
udata/core/dataset/search.py
Outdated
else: | ||
organization = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe initialize organization
, owner
and image_url
to None
before the ifs
? If feel more comfortable with this pattern but YMMV.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it's much better
|
||
document = { | ||
'title': dataset.title, | ||
'description': dataset.description, | ||
'license': (dataset.license.id | ||
if dataset.license is not None else None), | ||
'license': getattr(dataset.license, 'id', None), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
udata/core/reuse/search.py
Outdated
owner = User.objects(id=reuse.owner.id).first() | ||
organization = None | ||
else: | ||
organization = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark as above about initialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This PR optimize indexation by:
user.role
)