Skip to content

Commit

Permalink
"Refactor loadIndex method to assign loaded index items directly to i…
Browse files Browse the repository at this point in the history
…ndexItems variable."
  • Loading branch information
buhe committed Feb 14, 2024
1 parent b00ebd8 commit 39bbd0b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Sources/SimilaritySearchKit/Core/Index/SimilarityIndex.swift
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,9 @@ extension SimilarityIndex {

public func loadIndex(fromDirectory path: URL? = nil, name: String? = nil) throws -> [IndexItem]? {
if let indexPath = try getIndexPath(fromDirectory: path, name: name) {
let loadedIndexItems = try vectorStore.loadIndex(from: indexPath)
// addItems(loadedIndexItems) {[self] in
indexItems = try vectorStore.loadIndex(from: indexPath)
print("Loaded \(indexItems.count) index items from \(indexPath.absoluteString)")
// }
return loadedIndexItems
return indexItems
}

return nil
Expand Down

0 comments on commit 39bbd0b

Please sign in to comment.