1
0
Fork 0

Tuned last.fm autocomplete to do what i need (:

This commit is contained in:
magnolia-fan 2011-06-18 05:17:10 +04:00
parent c9ea9c6a27
commit aa5d5a51c6
1 changed files with 2 additions and 2 deletions

View File

@ -55,7 +55,7 @@ class ArtistController < ApplicationController
end
render :json => {
:query => params[:query],
:suggestions => suggestions
:suggestions => suggestions.take(10)
}
end
@ -63,7 +63,7 @@ class ArtistController < ApplicationController
return nil if query.nil? or query.strip.empty?
json = ActiveSupport::JSON.decode(open(
'http://www.last.fm/search/autocomplete' <<
'?q=' << URI.escape(query)
'?rows=30&q=' << URI.escape(query)
).read)
return json.empty? ? nil : json
end