<commit_before>class PostsController < ApplicationController
  before_action :authenticate_admin_user!, except: [:show, :index]
  before_action :set_post, only: [:show, :edit, :update, :destroy]
  before_action  :set_post_tags_to_gon, only: [:edit]

  # GET /posts
  # GET /posts.json
  def index
    @posts = params[:tag].present? ? Post.tagged_with(params[:tag]) : Post.all
    @q = @posts.search(params[:q])
    @posts = @q.result(distinct: true).includes(:tags)
  end

  # GET /posts/1
  # GET /posts/1.json
  def show
    @posts = Post.find(params[:id])
    @documents = @posts.documents.all
    @document = @posts.documents.build
  end

  # GET /posts/new
  def new<commit_msg>initial<commit_after>class PostsController < ApplicationController
  before_action :authenticate_admin_user!, except: [:show, :index]
  before_action :set_post, only: [:show, :edit, :update, :destroy]
  before_action  :set_post_tags_to_gon, only: [:edit]

  # GET /posts
  # GET /posts.json
  def index
    @posts = params[:tag].present? ? Post.tagged_with(params[:tag]) : Post.all
    @q = @posts.search(params[:q])
    @posts = @q.result(distinct: true).includes(:tags)
  end

  # GET /posts/1
  # GET /posts/1.
  def show
    @posts = Post.find(params[:id])
    @documents = @posts.documents.all
    @document = @posts.documents.build
  end

  # GET /posts/new
  def new
{'fraction_non_alphanumeric': 0.14749262536873156, 'fraction_numerical': 0.0029498525073746312, 'mean_word_length': 3.829181494661922, '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': '802205', 'n_tokens_mistral': 492, 'n_tokens_neox': 471, 'n_words': 103}