Skip to content

Search: use alias to link to search results of subprojects #7757

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

Merged
merged 6 commits into from
Dec 16, 2020

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Dec 15, 2020

Currently we are showing (result from {subproject_slug})
instead of the chosen alias.
With this now we can show the proper alias. The alias is tracked in the VersionData namedtuple that is passed into the context.

Also, start tracking the doctype of the version (it changes when the
version changes so we are good).
With this we can have the correct urls for all projects

Currently we are showing `(result from {subproject_slug})`
instead of the chosen alias.
With this now we can show the proper alias.

Also, start tracking the doctype of the version (it changes when the
version changes so we are good).
With this we can have the correct urls for all projects
https://github.com/readthedocs/readthedocs.org/blob/1675fd3ea55947ef1de681c87df625ff5bc43abd/readthedocs/search/serializers.py#L113
@stsewd stsewd changed the title Search: use alias to link to search results Search: use alias to link to search results of subprojects Dec 15, 2020
@stsewd stsewd requested a review from a team December 15, 2020 21:22
@stsewd stsewd force-pushed the search/use-alias-for-subprojects branch from 4b40524 to 05cc10a Compare December 15, 2020 21:24
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

This seems like a good approach. I dunno about VersionData having project_alias in it though. That feels messy and confusing, but I guess its fine for now.

@@ -69,6 +69,7 @@ class PageDocument(RTDDocTypeMixin, Document):
# Metadata
project = fields.KeywordField(attr='project.slug')
version = fields.KeywordField(attr='version.slug')
doctype = fields.KeywordField(attr='version.documentation_type')
Copy link
Member

Choose a reason for hiding this comment

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

Does this require reindexing?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, but we can do it the next year, we aren't using it yet (still querying from the db or falling back to None). Tracking it here #7762.

@stsewd
Copy link
Member Author

stsewd commented Dec 16, 2020

I dunno about VersionData having project_alias in it though

Yeah, I was thinking about having a structure like project: {'alias': 'alias', version: {...}}.

@stsewd stsewd force-pushed the search/use-alias-for-subprojects branch from b179719 to 33ed079 Compare December 16, 2020 19:33
@stsewd
Copy link
Member Author

stsewd commented Dec 16, 2020

I have changed it to use another structure.

Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

This looks good 👍

@stsewd stsewd merged commit 1bf51bd into master Dec 16, 2020
@stsewd stsewd deleted the search/use-alias-for-subprojects branch December 16, 2020 22:25
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.

2 participants