MCPcopy Create free account
hub / github.com/InferCore/InferCore / TestParseOpenSearchHits

Function TestParseOpenSearchHits

internal/retrieval/http_kb_test.go:50–66  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

48}
49
50func TestParseOpenSearchHits(t *testing.T) {
51 raw := `{
52 "hits": {
53 "hits": [
54 {"_index": "i", "_id": "1", "_score": 2.5, "_source": {"text": "alpha", "meta": "x"}},
55 {"_index": "i", "_id": "2", "_score": 1.0, "_source": {"content": "beta"}}
56 ]
57 }
58}`
59 res, err := parseOpenSearchHits([]byte(raw))
60 if err != nil {
61 t.Fatal(err)
62 }
63 if len(res.Chunks) != 2 || res.Chunks[0].Text != "alpha" || res.Chunks[1].Text != "beta" {
64 t.Fatalf("%+v", res.Chunks)
65 }
66}
67
68func TestParseMeilisearchHits(t *testing.T) {
69 raw := `{

Callers

nothing calls this directly

Calls 1

parseOpenSearchHitsFunction · 0.85

Tested by

no test coverage detected