-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add section linking for the search result #5829
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
Changes from 6 commits
ee1ba1a
4b05f8a
79d2459
54ceb5c
b11e357
5b81471
762a79d
7a61dbd
644565b
fa51a1c
0bc6be5
0139993
53a02e8
11ba9e7
6207f4e
a251a98
b6847b9
af2d69f
32d0bed
d472f29
878343d
f98d91c
7c1c641
fd8e8f7
f6221ec
8840606
60e229c
3835e2e
ae5033c
28e7cbf
1e2a40b
7b7a3c9
3931bc0
84a2494
5cae508
adb74ed
d500d98
9461d4f
75dcc2f
ea36138
451c0f4
0817d43
5305458
68cb7af
d62bf3e
ed16e56
0ed64f7
f988302
429b3e9
897e09f
aeaba6f
6f9b2bc
6135cde
d3566ac
992c72e
f0babf1
4527839
7e75d7e
1e6721d
2a4c070
4beec39
01346a0
91282de
cfe8f5b
7e99f6a
b7ce777
6701a4e
cee24ed
685f6db
d7edeee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,14 +48,14 @@ def get_inner_hits(self, obj): | |
domains = inner_hits.domains or [] | ||
all_results = itertools.chain(sections, domains) | ||
|
||
sorted_results = ( | ||
sorted_results = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @stsewd There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, I wasn't able to run the test because there is an import error, my guess is that when the generator gets evaluated the object Also, I'd just left the list comprehension, since we don't know when the generator gets evaluated by django rest. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will add comments there to avoid any confusion in the future. |
||
{ | ||
'type': hit._nested.field, | ||
'_source': hit._source.to_dict(), | ||
ericholscher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
'highlight': self._get_inner_hits_highlights(hit), | ||
} | ||
for hit in sorted(all_results, key=utils._get_hit_score, reverse=True) | ||
) | ||
] | ||
|
||
return sorted_results | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,11 +101,11 @@ class PageSearchBase(RTDFacetedSearch): | |
doc_types = [PageDocument] | ||
index = PageDocument._doc_type.index | ||
|
||
_outer_fields = ['title'] | ||
_section_fields = ['sections.title', 'sections.content'] | ||
_outer_fields = ['title^4'] | ||
_section_fields = ['sections.title^3', 'sections.content'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the boosters. |
||
_domain_fields = [ | ||
'domains.type_display', | ||
'domains.name', | ||
'domains.name^2', | ||
'domains.display_name', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure which fields are to be included. |
||
] | ||
fields = _outer_fields | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"path": "support", | ||
"title": "Support", | ||
"sections": [ | ||
{ | ||
"id": "usage-questions", | ||
"title": "Usage Questions", | ||
"content": "If you have questions about how to use Read the Docs, or have an issue that isn’t related to a bug, Stack Overflow is the best place to ask. Tag questions with read-the-docs so other folks can find them easily.. Good questions for Stack Overflow would be:. “What is the best way to structure the table of contents across a project?”. “How do I structure translations inside of my project for easiest contribution from users?”. “How do I use Sphinx to use SVG images in HTML output but PNG in PDF output?”" | ||
}, | ||
{ | ||
"id": "community-support", | ||
"title": "Community Support", | ||
"content": "Read the Docs is supported by community contributions and advertising. We hope to bring in enough money with our Gold and Ethical Ads programs to keep Read the Docs sustainable.. All people answering your questions are doing it with their own time, so please be kind and provide as much information as possible.. Bugs & Support Issues. You can file bug reports on our GitHub issue tracker, and they will be addressed as soon as possible. Support is a volunteer effort, and there is no guaranteed response time. If you need answers quickly, you can buy commercial support below.. Reporting Issues. When reporting a bug, please include as much information as possible that will help us solve this issue. This includes:. Project name. URL. Action taken. Expected result. Actual result. Specific Requests. If you need a specific request for your project or account, like more resources, change of the project’s slug or username. Send an email to [email protected]." | ||
}, | ||
{ | ||
"id": "commercial-support", | ||
"title": "Commercial Support", | ||
"content": "We offer commercial support for Read the Docs, commercial hosting, as well as consulting around all documentation systems. You can contact us at [email protected] to learn more, or read more at https://readthedocs.com/services/#open-source-support." | ||
} | ||
], | ||
"domains": [ | ||
{ | ||
"role_name": "http:post", | ||
"doc_name": "api/v3.html", | ||
"anchor": "post--api-v3-projects-(string-project_slug)-versions-(string-version_slug)-builds-", | ||
"type_display": "post", | ||
"doc_display": "API v3", | ||
"name": "/api/v3/projects/(string:project_slug)/versions/(string:version_slug)/builds/", | ||
"display_name": "" | ||
}, | ||
{ | ||
"role_name": "http:patch", | ||
"doc_name": "api/v3.html", | ||
"anchor": "patch--api-v3-projects-(string-project_slug)-version-(string-version_slug)-", | ||
"type_display": "patch", | ||
"doc_display": "API v3", | ||
"name": "/api/v3/projects/(string:project_slug)/version/(string:version_slug)/", | ||
"display_name": "" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,49 @@ | ||
{ | ||
"content": "ReadtheDocsWiping a Build Environment\nSometimes it happen that your Builds start failing because the build environment where the is created is stale or broken. This could happen for a couple of different reasons like pip not upgrading a package properly or a corrupted cached Python package.\nIn any of these cases (and many others), the solution could be just wiping out the existing build environment files and allow Read the Docs to create a new fresh one.\nFollow these steps to wipe the build environment:\nGo to Versions\nClick on the Edit button of the version you want to wipe on the right side of the page\nGo to the bottom of the page and click the wipe link, next to the \u201cSave\u201d button\nNote\nBy wiping the build environment, all the rst, md, and code files associated with it will be removed but not the already built (HTML and PDF files). Your will still online after wiping the build environment.\nNow you can re-build the version with a fresh build environment!", | ||
"headers": [ | ||
"Wiping a Build Environment" | ||
], | ||
"title": "Wiping a Build Environment", | ||
"sections": [ | ||
{ | ||
"content": "\nSometimes it happen that your Builds start failing because the build\nenvironment where the is created is stale or\nbroken. This could happen for a couple of different reasons like <code class=\"xref py py-obj docutils literal notranslate\"><span class=\"pre\">pip</span></code>\nnot upgrading a package properly or a corrupted cached Python package.\n\nIn any of these cases (and many others), the solution could be just\nwiping out the existing build environment files and allow Read the\nDocs to create a new fresh one.\n\nFollow these steps to wipe the build environment:\n\n\n<li>Go to <strong>Versions</strong></li>\n<li>Click on the <strong>Edit</strong> button of the version you want to wipe on the\nright side of the page</li>\n<li>Go to the bottom of the page and click the <strong>wipe</strong> link, next to\nthe \u201cSave\u201d button</li>\n\n\n\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">By wiping the build environment, all the <code class=\"xref py py-obj docutils literal notranslate\"><span class=\"pre\">rst</span></code>, <code class=\"xref py py-obj docutils literal notranslate\"><span class=\"pre\">md</span></code>,\nand code files associated with it will be removed but not the\n already built (<code class=\"xref py py-obj docutils literal notranslate\"><span class=\"pre\">HTML</span></code> and <code class=\"xref py py-obj docutils literal notranslate\"><span class=\"pre\">PDF</span></code> files). Your\n will still online after wiping the build environment.</p>\n\n\nNow you can re-build the version with a fresh build environment!\n", | ||
"id": "wiping-a-build-environment", | ||
"title": "Wiping a Build Environment" | ||
} | ||
], | ||
"path": "guides/wipe-environment" | ||
"path": "guides/wipe-environment", | ||
"title": "Wiping a Build Environment", | ||
"sections": [ | ||
{ | ||
"id": "wiping-a-build-environment", | ||
"title": "Wiping a Build Environment", | ||
"content": "Sometimes it happen that your Builds start failing because the build environment where the documentation is created is stale or broken. This could happen for a couple of different reasons like pip not upgrading a package properly or a corrupted cached Python package.In any of these cases (and many others), the solution could be just wiping out the existing build environment files and allow Read the Docs to create a new fresh one.Follow these steps to wipe the build environment:Click on the Edit button of the version you want to wipe on the right side of the page. Go to the bottom of the page and click the wipe link, next to the “Save” buttonBy wiping the documentation build environment, all the rst, md, and code files associated with it will be removed but not the documentation already built (HTML and PDF files). Your documentation will still online after wiping the build environment.Now you can re-build the version with a fresh build environment!" | ||
} | ||
], | ||
"domains": [ | ||
{ | ||
"role_name": "http:get", | ||
"doc_name": "api/v3.html", | ||
"anchor": "get--api-v3-users-(str-username)", | ||
"type_display": "get", | ||
"doc_display": "API v3", | ||
"name": "/api/v3/users/(str:username)", | ||
"display_name": "" | ||
}, | ||
{ | ||
"role_name": "http:get", | ||
"doc_name": "api/v3.html", | ||
"anchor": "get--api-v3-projects-(string-project_slug)-versions-(string-version_slug)-", | ||
"type_display": "get", | ||
"doc_display": "API v3", | ||
"name": "/api/v3/projects/(string:project_slug)/versions/(string:version_slug)/", | ||
"display_name": "" | ||
}, | ||
{ | ||
"role_name": "http:get", | ||
"doc_name": "api/v3.html", | ||
"anchor": "get--api-v3-projects-(string-project_slug)-versions-", | ||
"type_display": "get", | ||
"doc_display": "API v3", | ||
"name": "/api/v3/projects/(string:project_slug)/versions/", | ||
"display_name": "" | ||
}, | ||
{ | ||
"role_name": "http:get", | ||
"doc_name": "api/v3.html", | ||
"anchor": "get--api-v3-projects-(string-project_slug)-", | ||
"type_display": "get", | ||
"doc_display": "API v3", | ||
"name": "/api/v3/projects/(string:project_slug)/", | ||
"display_name": "" | ||
} | ||
] | ||
} |
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 could probably use a comment. Likely it should also test for a length before doing this, otherwise this check could be running on 0 sections.