     }
 
     private func removeFromSearchIndices(identifier: Model.CollectionIdentifier) throws {
-        guard self.useSearchIndices.get() ?? false else { return }
+        guard try self.shouldUseSearchIndices() else { return }
 
         let identifierBase64 = try self.encoder.encode(identifier.databaseKey()).base64EncodedString()
 

            """
            try db.exec(query: ftsTargets)

            useSearchIndices.put(true)
        } catch {
            // We can use FTS3 tables but queries yield different results when run on different
            // platforms. This could be because of SQLite version perhaps? But since we can't get
            // consistent results we will not fallback to FTS3 and just give up if FTS4 is not available.
            useSearchIndices.put(false)
        }
        #endif


        }

        self.targetTrie.remove { $0.collection == identifier }
    }

    private func shouldUseSearchIndices() throws -> Bool {
        // Make sure createSchemaIfNecessary is called and useSearchIndices is set before reading it
        try self.withDB { _ in
            self.useSearchIndices.get() ?? false
        }
    }

    internal func populateTargetTrie(callback: @escaping (Result<Void, Error>) -> Void = { _ in }) {
