<commit_before>module Api
  class ItemsController < ApiController

    before_action :require_login
    respond_to :json

    def index
      if params[:query]     # respond to jQuery autocomplete
        @items = Item.search_by_nombre params[:query]
        render json: @items, root: :suggestions, each_serializer: ItemAutocompleteSerializer
      else
        @items = Item.page(params[:page])
        render json: @items,
               meta: { total_pages: @items.total_pages,
                              page: @items.current_page }
      end
    end

  end
end
<commit_msg>now, it's not necessary to have `suggestions` as root<commit_after>module Api
  class ItemsController < ApiController

    before_action :require_login
    respond_to :json

    def index
      if params[:query]     # respond to jQuery autocomplete
        @items = Item.search_by_nombre params[:query]
        render json: @items, each_serializer: ItemAutocompleteSerializer
      else
        @items = Item.page(params[:page])
        render json: @items,
               meta: { total_pages: @items.total_pages,
                              page: @items.current_page }
      end
    end

  end
end

{'fraction_non_alphanumeric': 0.07529610829103214, 'fraction_numerical': 0.0, 'mean_word_length': 2.332394366197183, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4654896', 'n_tokens_mistral': 335, 'n_tokens_neox': 323, 'n_words': 90}