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:
parent
a37bb5cdba
commit
748cf253da
1 changed files with 10 additions and 8 deletions
|
|
@ -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:]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue