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

Link to cluster search should only include keyword search #545 #587

Merged
merged 1 commit into from
Feb 12, 2024
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 ppa/archive/templates/archive/snippets/cluster_work.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{# NOTE: expects cluster_id to be passed in #}
<div class="cluster-work icon container" >
{# TODO: include count if we can easily get it ; search and browse x digitized works within cluster #}
<a href="{% url "archive:list" %}?cluster={{ cluster_id }}&{% querystring_replace page=1 %}">search and browse within cluster</a>
{# ONLY include keyword search parameter, no other filters or sort options #}
<a href="{% url "archive:list" %}?cluster={{ cluster_id }}{% if request.GET.query %}&query={{ request.GET.query }}{% endif %}">search and browse within cluster</a>
</div>
8 changes: 7 additions & 1 deletion ppa/archive/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,11 +631,17 @@ def test_keyword_search(self):

self.assertContains(response, "search and browse within cluster", count=1)

# link preserves args
# link preserves keyword arg only but not any other parameters
self.assertContains(
response,
"<a href='/archive/?cluster=treatisewinter&query=wintry'>search and browse within cluster</a>", # noqa: E501
html=True,
)
self.assertNotContains(
response,
"/archive/?cluster=treatisewinter&query=wintry&sort=relevance&page=1",
)

# the non-cluster hit should appear
self.assertContains(response, "/archive/uc1.$b14645/?query=wintry")
# no hits for wintry in this cluster
Expand Down
Loading