app/controllers/scrivito/objs_controller.rb in scrivito_sdk-0.71.2 vs app/controllers/scrivito/objs_controller.rb in scrivito_sdk-0.90.0.rc1
- old
+ new
@@ -143,15 +143,23 @@
in_selected_workspace do
@query = MultiJson.decode(params[:query]).with_indifferent_access
@enumerator = ObjSearchBuilder.new(@query).build
if params[:query_action] == 'size'
- render :search_only_size
- elsif @formatter = fetch_formatter(@query[:format])
- render :search
- else
- render :format_missing_error, status: :not_found
+ return render action: 'search/size'
end
+
+ unless @formatter = fetch_formatter(@query[:format])
+ return render action: 'search/missing_formatter', status: :not_found
+ end
+
+ if facet_params = params[:facet]
+ attribute, options = MultiJson.decode(facet_params).values_at('attribute', 'options')
+ @facets = @enumerator.facet(attribute, options || {})
+ return render action: 'search/facet'
+ end
+
+ render :search
end
end
private