File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -541,7 +541,7 @@ public extension SearchClient {
541
541
batchSize: Int = 1000 ,
542
542
requestOptions: RequestOptions ? = nil
543
543
) async throws -> ReplaceAllObjectsResponse {
544
- let tmpIndexName = try " \( indexName) _tmp_ \( Int . random ( in: 1_000_000 ..< 10_000_000 ) ) "
544
+ let tmpIndexName = " \( indexName) _tmp_ \( Int . random ( in: 1_000_000 ..< 10_000_000 ) ) "
545
545
546
546
var copyOperationResponse = try await operationIndex (
547
547
indexName: indexName,
@@ -627,4 +627,14 @@ public extension SearchClient {
627
627
628
628
return timestampDate. timeIntervalSince1970 - Date( ) . timeIntervalSince1970
629
629
}
630
+
631
+ func indexExists( indexName: String ) async throws -> Bool {
632
+ do {
633
+ _ = try await self . getSettings ( indexName: indexName)
634
+ } catch let AlgoliaError . httpError( error) where error. statusCode == 404 {
635
+ return false
636
+ }
637
+
638
+ return true
639
+ }
630
640
}
You can’t perform that action at this time.
0 commit comments