<commit_before>package main

import (
	"encoding/json"
	"html/template"
	"net/http"

	"github.com/gorilla/mux"
)

type getTorrentData struct {
	pageData
	Torrent torrent
}

var torrentTemplate = template.Must(template.New("template").Funcs(templateFunctions).ParseFiles("templates/layout.html", "templates/page_torrent.html"))

func (a *app) getTorrent(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)

	res, err := a.es.Get().Index(a.config.esIndex).Id(vars["id"]).Do()
	if err != nil {
		http.Error(w, err.Error(), 500)
		return
	}

	if !res.Found {
		http.Error(w, "not found", 404)
		return
	}

	var t torrent
	if err := json.Unmarshal(*res.Source, &t); err != nil {
		http.Error(w, err.Error(), 500)
		return
	}

	pageData := getTorrentData{
		pageData: pageData{
			Title: t.Name,
		},
		Torrent: t,
	}

	if err := torrentTemplate.ExecuteTemplate(w, "layout", pageData); err != nil {
		http.Error(w, err.Error(), 500)
	}
}<commit_msg>use correct type for es<commit_after>package main

import (
	"encoding/json"
	"html/template"
	"net/http"

	"github.com/gorilla/mux"
)

type getTorrentData struct {
	pageData
	Torrent torrent
}

var torrentTemplate = template.Must(template.New("template").Funcs(templateFunctions).ParseFiles("templates/layout.html", "templates/page_torrent.html"))

func (a *app) getTorrent(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)

	res, err := a.es.Get().Index(a.config.esIndex).Type("torrent").Id(vars["id"]).Do()
	if err != nil {
		http.Error(w, err.Error(), 500)
		return
	}

	if !res.Found {
		http.Error(w, "not found", 404)
		return
	}

	var t torrent
	if err := json.Unmarshal(*res.Source, &t); err != nil {
		http.Error(w, err.Error(), 500)
		return
	}

	pageData := getTorrentData{
		pageData: pageData{
			Title: t.Name,
		},
		Torrent: t,
	}

	if err := torrentTemplate.ExecuteTemplate(w, "layout", pageData); err != nil {
		http.Error(w, err.Error(), 500)
	}
}
{'fraction_non_alphanumeric': 0.17114788004136505, 'fraction_numerical': 0.012409513960703205, 'mean_word_length': 4.119047619047619, 'pattern_counts': {'":': 0, '<': 3, '<?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': '459689', 'n_tokens_mistral': 794, 'n_tokens_neox': 724, 'n_words': 152}