Fix bug where search indexing wasn’t actually happening.
This commit is contained in:
parent
a1675f0640
commit
cb96fe64ed
@ -440,6 +440,7 @@ final class ArticlesTable: DatabaseTable {
|
|||||||
if articleIDs.isEmpty {
|
if articleIDs.isEmpty {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
self.searchTable.ensureIndexedArticles(articleIDs, database)
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.indexUnindexedArticles()
|
self.indexUnindexedArticles()
|
||||||
|
@ -77,12 +77,8 @@ final class SearchTable: DatabaseTable {
|
|||||||
self.ensureIndexedArticles(articleIDs, database)
|
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) {
|
func ensureIndexedArticles(_ articleIDs: Set<String>, _ database: FMDatabase) {
|
||||||
guard let articlesTable = articlesTable else {
|
guard let articlesTable = articlesTable else {
|
||||||
return
|
return
|
||||||
@ -97,6 +93,11 @@ private extension SearchTable {
|
|||||||
let indexedArticles = articleSearchInfos.filter { $0.searchRowID != nil }
|
let indexedArticles = articleSearchInfos.filter { $0.searchRowID != nil }
|
||||||
updateIndexForArticles(indexedArticles, database)
|
updateIndexForArticles(indexedArticles, database)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Private
|
||||||
|
|
||||||
|
private extension SearchTable {
|
||||||
|
|
||||||
func performInitialIndexForArticles(_ articles: Set<ArticleSearchInfo>, _ database: FMDatabase) {
|
func performInitialIndexForArticles(_ articles: Set<ArticleSearchInfo>, _ database: FMDatabase) {
|
||||||
articles.forEach { performInitialIndex($0, database) }
|
articles.forEach { performInitialIndex($0, database) }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user