/artists: drop deprecated search syntax, add regex search for names.

Drop support for the following pseudo-metatags in the Name field in the
artists search form:

* name:<name>
* other:<other name>
* group:<group name>
* status:banned
* status:active
* http://www.example.com

Instead, make the Name field do a wildcard search against the artist
name, group name, or other names. If the query looks like `/regex/`,
then do a regex search against any of these names.

/artists?search[name] now does a literal exact match and
/artists?search{any_name_matches] does the above wildcard/regex search.
This commit is contained in:
evazion
2018-09-21 18:34:39 -05:00
parent 237ab9b782
commit f917b83d6f
4 changed files with 10 additions and 39 deletions

View File

@@ -409,8 +409,7 @@ class ArtistTest < ActiveSupport::TestCase
assert_nil(Artist.other_names_match("artist").first)
assert_not_nil(Artist.other_names_match("aaa").first)
assert_not_nil(Artist.other_names_match("ccc_ddd").first)
assert_not_nil(Artist.search(:name => "other:aaa").first)
assert_not_nil(Artist.search(:name => "aaa").first)
assert_not_nil(Artist.search(:name => "artist").first)
assert_not_nil(Artist.search(:other_names_match => "aaa").first)
assert_not_nil(Artist.search(:any_name_matches => "aaa").first)
@@ -421,7 +420,6 @@ class ArtistTest < ActiveSupport::TestCase
yuu = FactoryBot.create(:artist, :name => "yuu", :group_name => "cat_or_fish")
cat_or_fish.reload
assert_equal("yuu", cat_or_fish.member_names)
assert_not_nil(Artist.search(:name => "group:cat_or_fish").first)
assert_not_nil(Artist.search(:group_name_matches => "cat_or_fish").first)
assert_not_nil(Artist.search(:any_name_matches => "cat_or_fish").first)