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

Show subprojects in search results #1866

Merged
merged 5 commits into from Feb 28, 2016
Merged

Show subprojects in search results #1866

merged 5 commits into from Feb 28, 2016

Conversation

@agjohnson
Copy link
Contributor

@agjohnson agjohnson commented Dec 17, 2015

Currently, file/section/etc searches show results from a queried project, but it would also be helpful to display results from subprojects. This could easily be performed by appending the subproject slugs/ids to the search queries that are searching for a specific project. Display would be altered comparing the project slug, and if different, noting "from project X" in a fashion similar to the way domain objects are displayed separately in project search.

Routing

The index routing will need to be changed here as well, as it is currently per-project, which will limit project responses. Projects can be routed to their root parent projects, to keep sub/super-projects all on the same shard. However, this creates some difficulty querying from inside a subproject:

  • Which route do we use when a project has multiple parent projects and a query is requested directly for this project?
  • Do we update the indexes for each route when a project has multiple parent projects?

Indexing should be updated to respect many to many relationships between projects, and multiple indexes will be updated when updating search indexes.

  • Update search queries to include subprojects, if any
  • Also include superprojects, if any?
  • Update routing on indexing, route to parent or root parent project
  • Display results in search output with project designation
  • Correct links to subproject pages in search results

This relies on #1808 and readthedocs/readthedocs-sphinx-ext#16

In action:
screen shot 2016-02-23 at 3 13 27 pm

@agjohnson agjohnson self-assigned this Feb 15, 2016
@agjohnson agjohnson added this to the Search milestone Feb 15, 2016
@agjohnson agjohnson force-pushed the indoc-subproject-search branch 2 times, most recently from 43164ce to e478b0b Feb 23, 2016
{"match": {"title": {"query": query, "boost": 10}}},
{"match": {"headers": {"query": query, "boost": 5}}},
{"match": {"content": {"query": query}}},
{"match_phrase": {
Copy link
Member

@ericholscher ericholscher Feb 24, 2016

This wlil likely require updating the .com's search overrides as well.

Copy link
Contributor Author

@agjohnson agjohnson Feb 24, 2016

Opened an issue on corporate to track this.

@ericholscher
Copy link
Member

@ericholscher ericholscher commented Feb 24, 2016

LGTM 👍

search_url.href = api_host;
search_url.pathname = '/api/v2/search';
search_url.search = '?q=' + query + '&project=' + project +
'&version=' + version + '&language=' + language;
Copy link
Contributor Author

@agjohnson agjohnson Feb 24, 2016

I'm not sure how we want to eventually handle subprojects/translations with regards to the search indexes. It doesn't hurt anything here for now, but the language query param is effectively a noop.

Copy link
Member

@ericholscher ericholscher Feb 24, 2016

We should be able to treat translations similar to subproject, since they are each their own "project", no? I guess we'd need to re-index when the translation was added in the Admin UI, but we can address this with a larger project around fixing i18n in general.

Copy link
Contributor Author

@agjohnson agjohnson Feb 26, 2016

Yeah, for now they are just their own projects. It would be best if a super project with language fr would search for subprojects with language fr as well. Definitely part of a larger refactor though.

@agjohnson agjohnson force-pushed the indoc-subproject-search branch 2 times, most recently from 148e6e8 to 02483e0 Feb 26, 2016
@agjohnson
Copy link
Contributor Author

@agjohnson agjohnson commented Feb 26, 2016

I addressed a few issues and rebased this. #1808 and this are unblocked now.

@agjohnson agjohnson force-pushed the indoc-subproject-search branch from cfca4e5 to 5efc121 Feb 28, 2016
agjohnson added a commit that referenced this issue Feb 28, 2016
@agjohnson agjohnson merged commit 32cab96 into master Feb 28, 2016
0 of 2 checks passed
@agjohnson agjohnson deleted the indoc-subproject-search branch Feb 28, 2016
@pgiraud
Copy link

@pgiraud pgiraud commented Jul 19, 2018

Can someone please confirm that it only work with sphinx and not with mkdocs?

@RichardLitt
Copy link
Member

@RichardLitt RichardLitt commented Jul 19, 2018

@pgiraud This is a pretty old issue, and your comment is likely to be lost, I think. I would encourage opening a new one and linking here. Thanks.

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

Successfully merging this pull request may close these issues.

None yet

4 participants