Semantic Search Over Court Decisions Without an LLM. Part 2: How I Measured It, in Go A Go 1.26 measurement over 810 Ukrainian court decisions (30.86 million characters) found that dropping the "all words" requirement raised recall@10 from 0.16 to 0.37 at $0 with no model, and that adding an embedding model contributed another 14 to 20 points, the author reported. The author's pre-registered decision rule caught data fitting: the best figure, 0.57, came from rules invented on the same 23 queries judged by one judge. The test ran against a temporary OpenSearch container on 127.0.0.1:9201, chunking documents by paragraph at a 1,500-character target and 2,500-character hard limit. Chunking, one client for an API and a local model, a spending cap that fires before the bill, blind judging, and a decision rule that caught me fitting the data This is my own measurement on my own data. The numbers are from November 2026, and I describe the subject area only in general terms. Every program output below comes from running the code shown here. Where I quote the original run instead of repeating it, I say so. In short: dropping the “all words” requirement raised recall@10 from 0.16 to 0.37, with no model and for $0. The model added another 14 to 20 points on top. And the decision rule I wrote before the first run caught me fitting the data: the best number, 0.57, comes from rules I invented on the same 23 queries. The code below shows how each of these numbers was measured. This is the second of three articles. Part 1 https://medium.com/@vladichumachenko/semantic-search-over-court-decisions-without-an-llm-part-1-i-expected-13-savings-and-got-30-305ffbb2dc52 was a no-code overview: what embedding models are, what they cost, why an open model beat a commercial one, and the first steps toward cross-language search. Part 2 is the practice: how to compare embedding models on your own data before you build the feature. Part 3 will cover how it runs day to day and what acceptance testing showed. It is still in progress. All the code is Go 1.26 with the standard library only: no SDKs, no frameworks. Every model here returns vectors over a plain HTTP protocol, so an SDK adds nothing. I ran the original measurement with quick scripts. For this article I rewrote the key parts in Go and checked them against the same data: I did not repeat the parts that cost money or depended on that particular day: the paid embedding log, the provider’s bill, the story of the dropped connections, and latency under load. Those places are marked. In the test output below I trimmed the file test.go:NN: prefixes and wrapped the longest lines. The numbers are unchanged. The corpus is 810 court decisions in Ukrainian, 30.86 million characters. It’s a debugging sample of decisions picked at random from public sources; the working corpus will start at 100,000 documents. The measurement had to answer two questions: I wrote the decision rule down before the first run. It had three outcomes: The number 10 was a judgment call with no statistics behind it. The gain had to be visible on 23 queries from one judge and pay for the memory the model would take. The second outcome matters as much as the first: it keeps a vector from “winning” where fixing keyword search would have been enough. How the rule played out is in the results section, and it’s the most useful part of this article. The OpenSearch node for the test is temporary: a separate container on 127.0.0.1:9201 with no data volume. It never touches the main node, and after the test I delete the container and nothing is left behind. An embedding model encodes a limited span of text, and one vector can’t describe a document tens of thousands of characters long. So each document is cut into chunks, and in search a document is represented by its best chunk. I first wanted to cut along the document’s logical sections. The data said no: almost all the text sat in one section. So I cut by paragraph. The target is 1,500 characters and the hard limit is 2,500. A paragraph is never split unless it’s longer than the limit, and then it’s split at the end of a sentence. const Target = 1500 // a passage aims at this many characters HardMax = 2500 // and never exceeds this many var paragraphBreak = regexp.MustCompile \n+ sentenceEnd = regexp.MustCompile . ?;: \s+ // runeLen counts characters, not bytes: a Cyrillic// letter is two bytes in UTF-8.func runeLen s string int { return utf8.RuneCountInString s }// Passages cuts a document into runs of whole paragraphs// of about Target characters, in reading order.func Passages text string string { var out string current := "" for , raw := range paragraphBreak.Split text, -1 { paragraph := strings.Join strings.Fields raw , " " if paragraph == "" { continue } parts := string{paragraph} if runeLen paragraph HardMax { parts = splitLong paragraph } for , part := range parts { if current = "" && runeLen current +1+runeLen part Target { out = append out, current current = part } else if current = "" { current += "\n" + part } else { current = part } } } if current = "" { out = append out, current } return out}// sentences splits after . ? ; : and drops the// whitespace that follows. RE2 has no lookbehind, so the// cut point is taken from the match itself.func sentences s string string { var out string start := 0 for , m := range sentenceEnd.FindAllStringIndex s, -1 { // the punctuation mark is one byte out = append out, s start:m 0 +1 start = m 1 } return append out, s start: } splitLong cuts a paragraph longer than HardMax into sentences, and a sentence longer than the limit at its last space. I left it out here for brevity. Go has two traps for Cyrillic text: A golden test checks the chunking: it cuts the whole corpus again and compares the SHA-256 of the chunk stream with the reference. passages: measure 24716, Go 24716documents 810, 30.5 passages each; characters median 1312, p95 1489, max 2499--- PASS: TestPassagesGolden 2.42s The result: chunks 24,716 30.5 per doc length, median 1,312 characters95th percentile 1,489 charactersmaximum 2,499 charactersvectors 24,716 × 1024 × f32 = 101 MB Ollama and OpenRouter speak the same protocol, the OpenAI-compatible /embeddings. So one client covers both, and only the address changes: https://openrouter.ai/api/v1 with a key for the API, and http://localhost:11434/v1 with no key for the local model. // Client speaks the OpenAI-compatible /embeddings protocol.// OpenRouter and a local Ollama both serve it, so one client// covers the API and the own copy.type Client struct { BaseURL string // OpenRouter or http://localhost:11434/v1 APIKey string // empty for Ollama HTTP http.Client}type embedRequest struct { Model string json:"model" Input string json:"input" Dimensions int json:"dimensions,omitempty" // OpenAI only}type embedResponse struct { Data struct { Index int json:"index" Embedding float32 json:"embedding" } json:"data" Usage struct { PromptTokens int json:"prompt tokens" } json:"usage" }// Embed returns one vector per text, in input order, and// the tokens the provider billed for the batch.func c Client Embed ctx context.Context, model string, texts string, dims int, float32, int, error { body, err := json.Marshal embedRequest{ Model: model, Input: texts, Dimensions: dims, } if err = nil { return nil, 0, err } var out embedResponse for attempt := 0; ; attempt++ { req, err := http.NewRequestWithContext ctx, http.MethodPost, c.BaseURL+"/embeddings", bytes.NewReader body if err = nil { return nil, 0, err } req.Header.Set "Content-Type", "application/json" if c.APIKey = "" { req.Header.Set "Authorization", "Bearer "+c.APIKey } resp, err := c.HTTP.Do req if err = nil { return nil, 0, err } retry := resp.StatusCode == http.StatusTooManyRequests || resp.StatusCode = 500 if retry && attempt < 5 { resp.Body.Close time.Sleep time.Duration 1<