lib/inquisitio/searcher.rb in inquisitio-1.0.0 vs lib/inquisitio/searcher.rb in inquisitio-1.1.0

- old
+ new

@@ -26,20 +26,20 @@ def search results end def ids - @ids ||= map{|r|r['data']['med_id'].first}.flatten.map(&:to_i) + @ids ||= map{|r|r['data']['id'].first}.flatten.map(&:to_i) end def records @records ||= begin klasses = {} results.map do |result| - klass = result['data']['med_type'].first + klass = result['data']['type'].first klasses[klass] ||= [] - klasses[klass] << result['data']['med_id'].first + klasses[klass] << result['data']['id'].first end klasses.map {|klass, ids| klass = klass.gsub("_", "::") klass.constantize.where(id: ids) @@ -125,10 +125,10 @@ end end def search_url @search_url ||= begin - return_fields = params[:returns].empty?? [:med_type, :med_id] : params[:returns] + return_fields = params[:returns].empty?? [:type, :id] : params[:returns] SearchUrlBuilder.build( query: params[:criteria], filters: params[:filters], arguments: params[:with].merge({