-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Search: allow to search on different versions of subprojects #7634
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
Conversation
074a6f0
to
a5cb8ac
Compare
Mainly this was done to allow us support searching on different versions of subprojects. Currently, we assume we search the same version for all subprojects. - _get_all_projects_data and _get_all_projects were merged into just one method. And instead of returning a list of projects we return a dictionary of project slugs mapped to a VersionData object. - There is some duplication in .com. `_has_permission` and `_get_subproject_versions_queryset` are overridden in .com. - ProjectData was renamed to VersionData since it has more attributes related to a version than a project.
f3590d6
to
9cacb2c
Compare
Mainly this was done to allow us support searching on different versions of subprojects. Currently, we assume we search the same version for all subprojects. - _get_all_projects_data and _get_all_projects were merged into just one method. And instead of returning a list of projects we return a dictionary of project slugs mapped to a VersionData object. - There is some duplication in .com. `_has_permission` and `_get_subproject_versions_queryset` are overridden in .com. - ProjectData was renamed to VersionData since it has more attributes related to a version than a project.
a5cb8ac
to
90accc5
Compare
90accc5
to
c908174
Compare
Mainly this was done to allow us support searching on different versions of subprojects. Currently, we assume we search the same version for all subprojects. - _get_all_projects_data and _get_all_projects were merged into just one method. And instead of returning a list of projects we return a dictionary of project slugs mapped to a VersionData object. - There is some duplication in .com. `_has_permission` and `_get_subproject_versions_queryset` are overridden in .com. - ProjectData was renamed to VersionData since it has more attributes related to a version than a project.
9cacb2c
to
e5c0337
Compare
985793d
to
628edad
Compare
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.
Solid improvement. The search logic is getting really complex, I wish I knew how to simplify it :/
) | ||
for project, version in self.projects.items() | ||
] | ||
bool_query = Bool(must=[bool_query, Bool(should=versions_query)]) |
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.
I"m a little worried about this as you noted, but lets see how it performs in prod.
Put this under a feature flag because who knows if this is going to explode in production :D
So, with filters you can't aggregate them to say "I want results from documents that match both, this version and project", so I had to use a bool query that represents this.
For projects where subprojects that don't match the same version as the parent project this will do an extra query (this may be not bad, I hope), we could fetch both in one query with an
or
, but then the logic would be a little more complex I think, but we can try that if this is slow.Also, if the search query is slow, we can try some things:
projects
method, and then merge the results (here I'm not sure if the score would be correct).Note: all other tests without the feature flag are also passing when I activated this feature by default, so the order of the results are the same as using the filters
Based on #7633