lib/musicbrainz/artist.rb in musicbrainz-0.7.0 vs lib/musicbrainz/artist.rb in musicbrainz-0.7.1

- old
+ new

@@ -37,30 +37,16 @@ :inc => [:url_rels] }) end def search(name) - artists = load({ + load({ :parser => :artist_search }, { :resource => :artist, - :query => CGI.escape(name).gsub(/\!/, '\!') + '~', - :limit => 50 + :query => "artist:" << CGI.escape(name).gsub(/\!/, '\!'), + :limit => 10 }) - artists.each { |artist| - if artist[:name].downcase == name.downcase - artist[:weight] += 80 - elsif artist[:name].downcase.gsub(/\s/, "") == name.downcase.gsub(/\s/, "") - artist[:weight] += 25 - elsif artist[:aliases].include? name - artist[:weight] += 20 - elsif artist[:aliases].map { |item| item.downcase }.include?(name.downcase) - artist[:weight] += 10 - elsif artist[:aliases].map { |item| item.downcase.gsub(/\s/, "") }.include?(name.downcase.gsub(/\s/, "")) - artist[:weight] += 5 - end - } - artists.sort{ |a, b| b[:weight] <=> a[:weight] }.take(10) end def discography(mbid) artist = find(mbid) artist.release_groups.each { |rg| rg.releases.each { |r| r.tracks } }