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.
This commit is contained in:
Max 2026-01-05 10:47:22 +08:00
parent a37bb5cdba
commit 748cf253da

View file

@ -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:]
}