Get a client instance each for a search

I recommend to put this code in an environment specific file, like e.g. development.rb in Rails.

Use it in your controller action

The controller action must return json.

Picky::Convenience offers a few methods that make handling

# The example uses Sinatra.
#
# For full results, you get the ids from the picky server
# and then populate the result with models.
#
get '/search/full' do
results = Books.search params[:query], :ids => params[:ids] :offset => params[:offset]
results.extend Picky::Convenience
results.populate_with Book do |book|
book.to_s
end
ActiveSupport::JSON.encode results
end
# For live results, can go directly to the search server.
#
# Or, as shown here, go
#
get '/search/live' do
Books.search_unparsed params[:query], :ids => 0, :offset => params[:offset]
end