Skip to content
Open
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
4 changes: 4 additions & 0 deletions app/models/search/tag_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def wrangling_status_filter
{ bool: { should: [exists_filter("merger_id"), term_filter(:canonical, true)] } }
when "noncanonical_nonsynonymous"
[{ bool: { must_not: exists_filter("merger_id") } }, term_filter(:canonical, false)]
when "unwrangleable"
term_filter(:unwrangleable, true)
when "noncanonical_nonsynonymous_not_unwrangleable"
[term_filter(:canonical, false), { bool: { must_not: exists_filter("merger_id") } }, term_filter(:unwrangleable, false)]
end
end

Expand Down
8 changes: 8 additions & 0 deletions app/views/tags/_search_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@
<%= f.radio_button :wrangling_status, "noncanonical_nonsynonymous" %>
<%= f.label :wrangling_status, t(".status_option.noncanonical_and_nonsynonymous"), value: "noncanonical_nonsynonymous" %>
</li>
<li>
<%= f.radio_button :wrangling_status, "noncanonical_nonsynonymous_not_unwrangleable" %>
<%= f.label :wrangling_status, t(".status_option.noncanonical_nonsynonymous_and_not_unwrangleable"), value: "noncanonical_nonsynonymous_not_unwrangleable" %>
</li>
<li>
<%= f.radio_button :wrangling_status, "unwrangleable" %>
<%= f.label :wrangling_status, t(".status_option.unwrangleable"), value: "unwrangleable" %>
</li>
<li>
<%= f.radio_button :wrangling_status, "" %>
<%= f.label :wrangling_status, t(".status_option.any_status"), value: "" %>
Expand Down
2 changes: 2 additions & 0 deletions config/locales/views/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2634,7 +2634,9 @@ en:
canonical_or_synonymous: Canonical or synonymous
noncanonical: Non-canonical
noncanonical_and_nonsynonymous: Non-canonical and non-synonymous
noncanonical_nonsynonymous_and_not_unwrangleable: Non-canonical and non-synonymous and not marked unwrangleable
synonymous: Synonymous
unwrangleable: Unwrangleable
tag_name: Tag name
type: Type
wrangling_status: Wrangling status
Expand Down
29 changes: 27 additions & 2 deletions features/tags_and_wrangling/tag_search.feature
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ Feature: Search Tags
Scenario: Search by wrangling status
Given a fandom exists with name: "Not Canon Fandom", canonical: false
And a character exists with name: "Canon Character", canonical: true
And a freeform exists with name: "Not Canon Unwrangleable Tag", unwrangleable: true
And a synonym "Same Canon Character" of the tag "Canon Character"
And all indexing jobs have been run
When I am on the search tags page
Expand All @@ -160,14 +161,16 @@ Feature: Search Tags
And I should not see the tag search result "Fandom: Not Canon Fandom (0)"
And I should see the tag search result "Character: Canon Character (0)"
And I should not see the tag search result "Character: Same Canon Character (0)"
And I should not see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)"
When I am on the search tags page
And I fill in "Tag name" with "Canon"
And I choose "Non-canonical"
And I press "Search Tags"
Then I should see "2 Found"
Then I should see "3 Found"
And I should see the tag search result "Fandom: Not Canon Fandom (0)"
And I should not see the tag search result "Character: Canon Character (0)"
And I should see the tag search result "Character: Same Canon Character (0)"
And I should see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)"
When I am on the search tags page
And I fill in "Tag name" with "Canon"
And I choose "Synonymous"
Expand All @@ -176,6 +179,7 @@ Feature: Search Tags
And I should not see the tag search result "Fandom: Not Canon Fandom (0)"
And I should not see the tag search result "Character: Canon Character (0)"
And I should see the tag search result "Character: Same Canon Character (0)"
And I should not see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)"
When I am on the search tags page
And I fill in "Tag name" with "Canon"
And I choose "Canonical or synonymous"
Expand All @@ -184,22 +188,43 @@ Feature: Search Tags
And I should not see the tag search result "Fandom: Not Canon Fandom (0)"
And I should see the tag search result "Character: Canon Character (0)"
And I should see the tag search result "Character: Same Canon Character (0)"
And I should not see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)"
When I am on the search tags page
And I fill in "Tag name" with "Canon"
And I choose "Non-canonical and non-synonymous"
And I press "Search Tags"
Then I should see "2 Found"
And I should see the tag search result "Fandom: Not Canon Fandom (0)"
And I should not see the tag search result "Character: Canon Character (0)"
And I should not see the tag search result "Character: Same Canon Character (0)"
And I should see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)"
When I am on the search tags page
And I fill in "Tag name" with "Canon"
And I choose "Unwrangleable"
And I press "Search Tags"
Then I should see "1 Found"
And I should not see the tag search result "Fandom: Not Canon Fandom (0)"
And I should not see the tag search result "Character: Canon Character (0)"
And I should not see the tag search result "Character: Same Canon Character (0)"
And I should see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)"
When I am on the search tags page
And I fill in "Tag name" with "Canon"
And I choose "Non-canonical and non-synonymous and not marked unwrangleable"
And I press "Search Tags"
Then I should see "1 Found"
And I should see the tag search result "Fandom: Not Canon Fandom (0)"
And I should not see the tag search result "Character: Canon Character (0)"
And I should not see the tag search result "Character: Same Canon Character (0)"
And I should not see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)"
When I am on the search tags page
And I fill in "Tag name" with "Canon"
And I choose "Any status"
And I press "Search Tags"
Then I should see "3 Found"
Then I should see "4 Found"
And I should see the tag search result "Fandom: Not Canon Fandom (0)"
And I should see the tag search result "Character: Canon Character (0)"
And I should see the tag search result "Character: Same Canon Character (0)"
And I should see the tag search result "Freeform: Not Canon Unwrangleable Tag (0)"

Scenario: Search and sort by Date Created in descending and ascending order
Given a freeform exists with name: "created first", created_at: "2008-01-01 20:00:00 Z"
Expand Down
2 changes: 1 addition & 1 deletion spec/models/search/tag_query_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
end

it "does not return unwrangleable tags" do
expect(results).not_to include(tags[:unwrangeable])
expect(results).not_to include(tags[:unwrangleable])
end

it "does not return wrangled tags" do
Expand Down
Loading