INNER CODE UNIT · Swift

saveIndex

ZachNagengast/similarity-search-kit · Sources/SimilaritySearchKit/Core/Index/SimilarityIndex.swift:319

    func saveIndex(toDirectory path: URL? = nil, name: String? = nil) throws -> URL {
        let indexName = name ?? self.indexName
        let basePath: URL

        if let specifiedPath = path {
            basePath = specifiedPath
        } else {
            // Default local path
            basePath = try getDefaultStoragePath()
        }

        let savedVectorStore = try vectorStore.saveIndex(items: indexItems, to: basePath, as: indexName)

        print("Saved \(indexItems.count) index items to \(savedVectorStore.absoluteString)")

        return savedVectorStore
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…