<commit_before>class SearchController < ApplicationController
  def search
    @query = Query.new(search_params[:query])
    @query.site_id = current_site.id
    searcher = PostSearcher.new
    @result_set = searcher.search(@query)
    searched_post_ids = @result_set.posts.map(&:_key)
    @posts = Post.published.where(id: searched_post_ids).order_by_recently.page(params[:page]).per(50)
  end

  private
<commit_msg>Prevent N+1<commit_after>class SearchController < ApplicationController
  def search
    @query = Query.new(search_params[:query])
    @query.site_id = current_site.id
    searcher = PostSearcher.new
    @result_set = searcher.search(@query)
    searched_post_ids = @result_set.posts.map(&:_key)
    @posts = Post.includes(credits: [:participant]).published.where(id: searched_post_ids).order_by_recently.page(params[:page]).per(50)
  end

  private

{'fraction_non_alphanumeric': 0.12211981566820276, 'fraction_numerical': 0.00576036866359447, 'mean_word_length': 5.034722222222222, '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': '3612164', 'n_tokens_mistral': 290, 'n_tokens_neox': 292, 'n_words': 42}