|
|
@ -194,19 +194,12 @@ public class FullTextSearchFinder: NSObject {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static let messageIndexer: SearchIndexer<TSMessage> = SearchIndexer { (message: TSMessage, transaction: YapDatabaseReadTransaction) in
|
|
|
|
private static let messageIndexer: SearchIndexer<TSMessage> = SearchIndexer { (message: TSMessage, transaction: YapDatabaseReadTransaction) in
|
|
|
|
if let body = message.body, body.count > 0 {
|
|
|
|
if let bodyText = message.bodyText(with: transaction) {
|
|
|
|
return body
|
|
|
|
return bodyText
|
|
|
|
}
|
|
|
|
|
|
|
|
if let oversizeText = oversizeText(forMessage: message, transaction: transaction) {
|
|
|
|
|
|
|
|
return oversizeText
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static func oversizeText(forMessage message: TSMessage, transaction: YapDatabaseReadTransaction) -> String? {
|
|
|
|
|
|
|
|
return message.oversizeText(with: transaction)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class func indexContent(object: Any, transaction: YapDatabaseReadTransaction) -> String? {
|
|
|
|
private class func indexContent(object: Any, transaction: YapDatabaseReadTransaction) -> String? {
|
|
|
|
if let groupThread = object as? TSGroupThread {
|
|
|
|
if let groupThread = object as? TSGroupThread {
|
|
|
|
return self.groupThreadIndexer.index(groupThread, transaction: transaction)
|
|
|
|
return self.groupThreadIndexer.index(groupThread, transaction: transaction)
|
|
|
|