-
Notifications
You must be signed in to change notification settings - Fork 0
Add search summary panel and full filter support #117
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 all commits
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<% return unless applied_filters.any? %> | ||
|
||
<div class="filter-summary"> | ||
<h2 class="hd-filter-summary hd-5">Applied filters: </h2> | ||
<ul class="list-filter-summary list-inline"> | ||
<% applied_filters.each do |filter| %> | ||
<li> | ||
<a href="<%= results_path(remove_filter(@enhanced_query, filter.keys[0], filter.values[0])) %>"> | ||
<%= "#{nice_labels[filter.keys[0]] || filter.keys[0]}: #{filter.values[0]}" %> | ||
<span class="sr">Remove applied filter?</span> | ||
</a> | ||
</li> | ||
<% end %> | ||
</ul> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,7 +91,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest | |
assert_response :success | ||
assert_nil flash[:error] | ||
|
||
assert_select 'li', 'Keyword anywhere: hallo' | ||
assert_select 'input[value=?]', 'hallo' | ||
end | ||
end | ||
|
||
|
@@ -272,6 +272,8 @@ class SearchControllerTest < ActionDispatch::IntegrationTest | |
|
||
# Advanced search behavior | ||
test 'advanced search by keyword' do | ||
skip("We no longer display a list of search terms in the UI; leaving this in in case we decide to reintroduce" \ | ||
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 know you brought this to the team last week, but after seeing in action, I'm fairly hesitant to remove this feature as it reads very weird the way it is implemented as it feels like it sits halfway between "these are all the things you searched for" and "these are the filters that are applied but please look at the form above for the rest of the values you searched for". i.e. the words say one thing but the implementation is the other... which is awkward. My preference would be to label it in the way it is currently functioning ( If there is a ticket to resolve this distinction after talking with UX when they are back from vacation, I could probably get over this :) 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'd strongly prefer changing the label to 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. Also, sprint planning reminded me that I created a ticket to figure out what we want to do with advanced search terms: https://mitlibraries.atlassian.net/browse/GDT-196 |
||
"that feature soon.") | ||
VCR.use_cassette('advanced keyword asdf', | ||
allow_playback_repeats: true, | ||
match_requests_on: %i[method uri body]) do | ||
|
@@ -291,12 +293,12 @@ class SearchControllerTest < ActionDispatch::IntegrationTest | |
get '/results?citation=asdf&advanced=true' | ||
assert_response :success | ||
assert_nil flash[:error] | ||
|
||
assert_select 'li', 'Citation: asdf' | ||
end | ||
end | ||
|
||
test 'advanced search can accept values from all fields' do | ||
skip("We no longer display a list of search terms in the UI; leaving this in in case we decide to reintroduce" \ | ||
"that feature soon.") | ||
VCR.use_cassette('advanced all', | ||
allow_playback_repeats: true, | ||
match_requests_on: %i[method uri body]) do | ||
|
@@ -359,7 +361,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest | |
end | ||
|
||
def source_filter_count(controller) | ||
controller.view_context.assigns['filters']['source'].count | ||
controller.view_context.assigns['filters'][:sourceFilter].count | ||
end | ||
|
||
test 'advanced search can limit to a single source' do | ||
|
@@ -369,7 +371,7 @@ def source_filter_count(controller) | |
query = { | ||
q: 'data', | ||
advanced: 'true', | ||
source: ['Woods Hole Open Access Server'] | ||
sourceFilter: ['Woods Hole Open Access Server'] | ||
}.to_query | ||
get "/results?#{query}" | ||
assert_response :success | ||
|
@@ -406,7 +408,7 @@ def source_filter_count(controller) | |
query = { | ||
q: 'data', | ||
advanced: 'true', | ||
source: ['Abdul Latif Jameel Poverty Action Lab Dataverse', 'Woods Hole Open Access Server'] | ||
sourceFilter: ['Abdul Latif Jameel Poverty Action Lab Dataverse', 'Woods Hole Open Access Server'] | ||
}.to_query | ||
get "/results?#{query}" | ||
assert_response :success | ||
|
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.
Does this feel like a workaround to a deficiency in our API? Or is this something only our UI is likely to encounter?
It feels like we should be returning our aggregations using the same terminology as we use to apply them. So instead of returning
source
we should return that aggregation assourceFilter
so it is clearer how to use the data. Thoughts?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.
Possibly. I hate this code, and manipulating the response this much in the UI certainly feels like a workaround, but I don't know if I'm convinced we should change our aggregation names. Since they're not filter/filters aggregations, naming them as such might be confusing to other consumers. Less confusing than having different names for the corresponding aggs, though? I'm not sure.