From 21472bdc720bf0f84e251748c5b1b07c2d8eb525 Mon Sep 17 00:00:00 2001 From: Sebastian Frank Date: Mon, 19 Oct 2026 22:34:56 +0000 Subject: [PATCH] =?UTF-8?q?Schema:=20ngram.sizes=20auf=202=E2=80=9310=20be?= =?UTF-8?q?grenzen,=20combinedCache=20erg=C3=A4nzen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Die Gesamtabnahme fand zwei Lücken im Config-Vertrag: - ngram.sizes erlaubte minimum 1 und hatte kein maximum; der Server akzeptiert nur 2–10 (collection_setup.go) — das Schema ließ also Configs durch, die beim Projektload scheitern. - combinedCache fehlte komplett, obwohl Server (models.CombinedCacheConfig) und Doku den Block als Projekt-YAML führen; additionalProperties:false lehnte gültige, dokumentierte Configs ab. Ergänzt in collection.schema.json und index.d.ts (CombinedCacheConfig mit enabled/ttl/maxEntries). Die Demo-Collection ngram-stopwords.yml enthält jetzt eine Combined-Config mit combinedCache, sodass validate:schemas den Block abdeckt. Gegenprobe per AJV: sizes [1] und [11] werden abgelehnt, [2,3] und combinedCache akzeptiert. --- demo-api/collections/ngram-stopwords.yml | 11 +++++++++++ index.d.ts | 8 ++++++++ schemas/config/collection.schema.json | 19 ++++++++++++++++++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/demo-api/collections/ngram-stopwords.yml b/demo-api/collections/ngram-stopwords.yml index bd5837a..7b5429a 100644 --- a/demo-api/collections/ngram-stopwords.yml +++ b/demo-api/collections/ngram-stopwords.yml @@ -30,3 +30,14 @@ search: enabled: true maxDocs: 150000 maxMemoryMB: 512 + - name: combined + mode: combined + rrf: + k: 60 + topK: 100 + weights: + fuzzy: 1.0 + combinedCache: + enabled: true + ttl: 45s + maxEntries: 1000 diff --git a/index.d.ts b/index.d.ts index 6592e82..1dc8550 100644 --- a/index.d.ts +++ b/index.d.ts @@ -90,6 +90,12 @@ declare global { minMatchRatio?: number } + export interface CombinedCacheConfig { + enabled?: boolean + ttl?: string + maxEntries?: number + } + export interface NgramInMemoryConfig { enabled?: boolean maxDocs?: number @@ -193,6 +199,8 @@ declare global { filter?: { [key: string]: any } /** Ngram search configuration */ ngram?: NgramConfig + /** Result cache for combined searches */ + combinedCache?: CombinedCacheConfig /** Regex search configuration */ regex?: RegexConfig /** Custom scoring for eval/filter search */ diff --git a/schemas/config/collection.schema.json b/schemas/config/collection.schema.json index dd4ec33..edc234d 100644 --- a/schemas/config/collection.schema.json +++ b/schemas/config/collection.schema.json @@ -321,7 +321,8 @@ "type": "array", "items": { "type": "integer", - "minimum": 1 + "minimum": 2, + "maximum": 10 } }, "normalize": { @@ -387,6 +388,22 @@ } } }, + "combinedCache": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "ttl": { + "type": "string" + }, + "maxEntries": { + "type": "integer", + "minimum": 0 + } + } + }, "regex": { "type": "object", "additionalProperties": false,