Fix bug where search indexing wasn’t actually happening.

This commit is contained in:
Brent Simmons 2019-12-08 11:49:02 -08:00
parent a1675f0640
commit cb96fe64ed
2 changed files with 7 additions and 5 deletions

View File

@ -440,6 +440,7 @@ final class ArticlesTable: DatabaseTable {
if articleIDs.isEmpty {
return
}
self.searchTable.ensureIndexedArticles(articleIDs, database)
DispatchQueue.main.async {
self.indexUnindexedArticles()

View File

@ -77,12 +77,8 @@ final class SearchTable: DatabaseTable {
self.ensureIndexedArticles(articleIDs, database)
}
}
}
// MARK: - Private
private extension SearchTable {
/// Add to, or update, the search index for articles with specified IDs.
func ensureIndexedArticles(_ articleIDs: Set<String>, _ database: FMDatabase) {
guard let articlesTable = articlesTable else {
return
@ -97,6 +93,11 @@ private extension SearchTable {
let indexedArticles = articleSearchInfos.filter { $0.searchRowID != nil }
updateIndexForArticles(indexedArticles, database)
}
}
// MARK: - Private
private extension SearchTable {
func performInitialIndexForArticles(_ articles: Set<ArticleSearchInfo>, _ database: FMDatabase) {
articles.forEach { performInitialIndex($0, database) }