-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
43164ce
to
e478b0b
Compare
{"match": {"title": {"query": query, "boost": 10}}}, | ||
{"match": {"headers": {"query": query, "boost": 5}}}, | ||
{"match": {"content": {"query": query}}}, | ||
{"match_phrase": { |
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 wlil likely require updating the .com's search overrides as well.
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.
Opened an issue on corporate to track this.
LGTM 👍 |
search_url.href = api_host; | ||
search_url.pathname = '/api/v2/search'; | ||
search_url.search = '?q=' + query + '&project=' + project + | ||
'&version=' + version + '&language=' + language; |
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 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.
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.
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.
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.
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.
148e6e8
to
02483e0
Compare
I addressed a few issues and rebased this. #1808 and this are unblocked now. |
02483e0
to
cfca4e5
Compare
cfca4e5
to
5efc121
Compare
Show subprojects in search results
Can someone please confirm that it only work with sphinx and not with mkdocs? |
@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. |
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:
Indexing should be updated to respect many to many relationships between projects, and multiple indexes will be updated when updating search indexes.
This relies on #1808 and readthedocs/readthedocs-sphinx-ext#16
In action: