Add pass logic.

Change-Id: Ibd0a8d67fd3d73435761ca2c495265eaf51a06d5
pull/1268/head
Jaehwa Noh 4 months ago
parent 6ab93572fe
commit 9b0946ae12

@ -69,6 +69,10 @@ internal class DefaultSearchContentsRepository @Inject constructor(
return@forEach
}
if (oldNewsResourceFtsEntities.firstOrNull() == newsResourceFtsEntity) {
return@forEach
}
newsResourceFtsDao.update(
title = newsResourceFtsEntity.title,
content = newsResourceFtsEntity.content,
@ -78,20 +82,24 @@ internal class DefaultSearchContentsRepository @Inject constructor(
topicDao.getOneOffTopicEntities().forEach { topicEntity ->
val oldTopicFtsEntities = topicFtsDao.getFtsEntitiesById(topicEntity.id)
val size = oldTopicFtsEntities.size
val topicFtsEntity = topicEntity.asFtsEntity()
if (size == 0) {
topicFtsDao.insert(topicEntity.asFtsEntity())
topicFtsDao.insert(topicFtsEntity)
return@forEach
}
// Do it for migration, multiple same id entity exists in the fts database.
if (size > 1) {
topicFtsDao.deleteById(topicEntity.id)
topicFtsDao.insert(topicEntity.asFtsEntity())
topicFtsDao.insert(topicFtsEntity)
return@forEach
}
if (oldTopicFtsEntities.firstOrNull() == topicFtsEntity) return@forEach
topicFtsDao.update(
name = topicEntity.name,
shortDescription = topicEntity.shortDescription,

Loading…
Cancel
Save