我想添加通过消息文本内容在LayerKit中搜索对话/消息的功能。这可能吗?我假设我需要以某种方式查询LYRMessage的LYRMessagePart,但我没有运气。
这样的事情似乎应该是可行的:
let messageTextQuery = LYRQuery(queryableClass: LYRMessage.self)
messageTextQuery.predicate = LYRPredicate(property: "parts.text", predicateOperator: LYRPredicateOperator.like, value: "%%\(searchText)%%")
messageTextQuery.sortDescriptors = [NSSortDescriptor(key: "position", ascending: false)]
layerClient.execute(messageTextQuery) { results, error in
if let results = results {
// do stuff with results
}
}