From 748cf253daa5629e4e4d8c5431fae2cab2ff3c21 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 5 Jan 2026 10:47:22 +0800 Subject: [PATCH] Refactor extractCollectionIDFromDocID Function - Simplified the extractCollectionIDFromDocID function by directly returning the first part of the docID, removing unnecessary logic for prefix handling. - Commented out the previous logic for clarity and potential future reference, maintaining code readability. --- openapi/kb/document.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/openapi/kb/document.go b/openapi/kb/document.go index 826a5832..3b055d2e 100644 --- a/openapi/kb/document.go +++ b/openapi/kb/document.go @@ -363,12 +363,14 @@ func extractCollectionIDFromDocID(docID string) string { if len(parts) < 2 { return "" } - // First part contains prefix_collection_id - prefix := parts[0] - // Find the first underscore to skip the prefix - idx := strings.Index(prefix, "_") - if idx == -1 { - return prefix - } - return prefix[idx+1:] + + return parts[0] + // // First part contains prefix_collection_id + // prefix := parts[0] + // // Find the first underscore to skip the prefix + // idx := strings.Index(prefix, "_") + // if idx == -1 { + // return prefix + // } + // return prefix[idx+1:] }