开发者

Core Data: Search for existence of a single word

开发者 https://www.devze.com 2023-02-19 08:12 出处:网络
I have an iPhone Core Data database with over 170,000 words in it. Just words, nothing else. When I preform a pretty complex regular expression fetch, it only takes about 10 seconds to get the returne

I have an iPhone Core Data database with over 170,000 words in it. Just words, nothing else. When I preform a pretty complex regular expression fetch, it only takes about 10 seconds to get the returned results. Yet when I use a predicate like below, it takes about 7 seconds. Shouldn't it take far less than that amount of time to complete the request? With the below example I'm simply checking 开发者_JS百科that the particular word, in this case "apple" exists in the database. Is there a better way to do this?

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"word LIKE 'apple'"];


[NSPredicate predicateWithFormat:@"'apple' <=  word AND word < 'applf'"];
0

精彩评论

暂无评论...
验证码 换一张
取 消