Skip to content

Remove 'highlight' URL param from search results #6087

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 4 commits into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion readthedocs/core/static-src/core/js/doc-embed/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ function attach_elastic_search_query(data) {
}

// Creating the result from elements
var link = doc.link + DOCUMENTATION_OPTIONS.FILE_SUFFIX + "?highlight=" + $.urlencode(query);
var link = doc.link + DOCUMENTATION_OPTIONS.FILE_SUFFIX;

var item = $('<a>', {'href': link});

item.html(title);
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/core/static/core/js/readthedocs-doc-embed.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions readthedocs/templates/search/elastic_search.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ <h3>

{% elif 'page' in result.meta.index %}
{% with "100" as MAX_SUBSTRING_LIMIT %}
<a href="{% doc_url result.project|get_project result.version result.full_path %}?highlight={{ query }}">
<a href="{% doc_url result.project|get_project result.version result.full_path %}">
{{ result.project }} - {% if result.meta.highlight.title %} {{ result.meta.highlight.title.0|safe }} {% else %} {{ result.title }} {% endif %}
</a>

{% for inner_hit in result.meta.inner_hits %}
{% if inner_hit.type == 'domains' %}
<p>
<a href="{% doc_url result.project|get_project result.version result.full_path %}?highlight= {{ query }}#{{ inner_hit.source.anchor }}">
<a href="{% doc_url result.project|get_project result.version result.full_path %}#{{ inner_hit.source.anchor }}">
{% if inner_hit.highlight|get_key_or_none:"domains.name" %}
{% with domain_name=inner_hit.highlight|get_key_or_none:"domains.name" %}
[{{ inner_hit.source.role_name }}]: {{ domain_name.0|safe }}
Expand All @@ -211,7 +211,7 @@ <h3>

{% elif inner_hit.type == 'sections' %}
<p>
<a href="{% doc_url result.project|get_project result.version result.full_path %}?highlight={{ query }}#{{ inner_hit.source.id }}">
<a href="{% doc_url result.project|get_project result.version result.full_path %}#{{ inner_hit.source.id }}">
{% if inner_hit.highlight|get_key_or_none:"sections.title" %}
{% with section_title=inner_hit.highlight|get_key_or_none:"sections.title" %}
{{ section_title.0|safe }}
Expand Down