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

AO3-6541 Update Works search and filters to use "Creator" instead of "Author/Artist" #4553

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
22 changes: 11 additions & 11 deletions app/models/search/work_search_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def summary
summary << "Title: #{@options[:title]}"
end
if @options[:creators].present?
summary << "Author/Artist: #{@options[:creators]}"
summary << "Creator: #{@options[:creators]}"
end
tags = @searcher.included_tag_names
all_tag_ids = @searcher.filter_ids
Expand Down Expand Up @@ -176,16 +176,16 @@ def search_results
###############

SORT_OPTIONS = [
['Best Match', '_score'],
['Author', 'authors_to_sort_on'],
['Title', 'title_to_sort_on'],
['Date Posted', 'created_at'],
['Date Updated', 'revised_at'],
['Word Count', 'word_count'],
['Hits', 'hits'],
['Kudos', 'kudos_count'],
['Comments', 'comments_count'],
['Bookmarks', 'bookmarks_count']
["Best Match", "_score"],
["Creator", "authors_to_sort_on"],
["Title", "title_to_sort_on"],
["Date Posted", "created_at"],
["Date Updated", "revised_at"],
["Word Count", "word_count"],
["Hits", "hits"],
["Kudos", "kudos_count"],
["Comments", "comments_count"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if I should actually do this, since we have instances of whitespace in "Date Posted", "Date Updated", etc. so it wouldn't be consistent on each? I'm a Ruby noob, welcome to other thoughts here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally don't love the mix of array styles, but we do it in the tag_search_form, so I guess it makes sense to do it here as well.

["Bookmarks", "bookmarks_count"]
].freeze

def sort_columns
Expand Down
2 changes: 1 addition & 1 deletion app/views/works/_search_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<%= f.text_field :title %>
</dd>
<dt>
<%= f.label :creators, ts("Author/Artist") %>
<%= f.label :creators, ts("Creator") %>
</dt>
<dd>
<%= f.text_field :creators %>
Expand Down
8 changes: 4 additions & 4 deletions features/search/works_anonymous.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Feature: Search anonymous works
And I should see "1 Found"
And I should see "Fulfilled Story-thing"
When I go to the search works page
And I fill in "Author/Artist" with "Anonymous"
And I fill in "Creator" with "Anonymous"
And I press "Search" within "#new_work_search"
Then I should see "You searched for: Author/Artist: Anonymous"
Then I should see "You searched for: Creator: Anonymous"
And I should see "1 Found"
And I should see "Fulfilled Story-thing"

Expand All @@ -45,8 +45,8 @@ Feature: Search anonymous works
And I should see "1 Found"
And I should see "Fulfilled Story-thing"
When I go to the search works page
And I fill in "Author/Artist" with "mod1"
And I fill in "Creator" with "mod1"
And I press "Search" within "#new_work_search"
Then I should see "You searched for: Author/Artist: mod1"
Then I should see "You searched for: Creator: mod1"
And I should see "1 Found"
And I should see "Fulfilled Story-thing"
6 changes: 3 additions & 3 deletions features/search/works_info.feature
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Feature: Search works by work info
Then I should see "You searched for: word count: >15000 revised at: > 2 years ago"
And I should see "No results found"

Scenario: Search with the header search field and then refine by author/artist
Scenario: Search with the header search field and then refine by creator
Given I have the Battle set loaded
When I fill in "site_search" with "testuser2"
And I press "Search"
Expand All @@ -54,9 +54,9 @@ Feature: Search works by work info
Then I should be on the search works page
And the field labeled "Any Field" should contain "testuser2"
When I fill in "Any Field" with ""
And I fill in "Author/Artist" with "testuser2"
And I fill in "Creator" with "testuser2"
And I press "Search" within "#new_work_search"
Then I should see "You searched for: Author/Artist: testuser2"
Then I should see "You searched for: Creator: testuser2"
And I should see "3 Found"
And I should see "fourth"
And I should see "fifth"
Expand Down
2 changes: 1 addition & 1 deletion public/help/work-search-text-help.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ <h4>Work Search: Any Field</h4>

<p>Searches all the fields associated with a work in the database, including summary, notes and tags, but not the full work text.</p>

<p>The characters ":" and "@" have special meanings. Leave them out of your search or you will get unexpected results. Like in the Title and Author/Artist field, you can use the following operators to combine your search terms:</p>
<p>The characters ":" and "@" have special meanings. Leave them out of your search or you will get unexpected results. Like in the Title and Creator field, you can use the following operators to combine your search terms:</p>

<dl>
<dt>*: any characters </dt>
Expand Down