TOKENMATCHES[cdl] 中的 "cdl" 是做什么的?

What's the "cdl" do in TOKENMATCHES[cdl]?

我在 Introducing CloudKit and was curious, so I did a google search and found very little about it outside of 的第 31 分钟遇到了 TOKENMATCHES。

NSPredicate(format: "ALL tokenize(%@, 'Cdl') IN allTokens", "after session")

实际上,更令人困惑的是,post 使用与 WWDC 视频不同的语法:

NSPredicate(format: "allTokens TOKENMATCHES[cdl] %@", "bob smith")

据我了解,这些查询 return 在一个或多个文本字段中具有所有标记化字符串参数的任何记录。后一种情况会获取一条记录,比如 person.name = "bob"person.last = "smith",以及一条记录 person.note = "Bob likes Joseph Smith."。 (欢迎指正。)

综上所述,这个问题不是关于完整的谓词,而是关于 cdl(或 Cdl?)parameter/modifier/whateverthehellitis.

TL;DR—cdl 是什么意思,还有其他值可以放入格式字符串的 "slot" 中吗?


为什么 predicate syntax documentation comprehensive? It's as if Apple's managers are scared of the mysterious, ancient power that is NSPredicate; none dare assign the technical writer and engineer needed to make this otherwise simple class accessible to the Rest of Us™. A Google search for "nspredicate TOKENMATCHES" 不只给出 8 个结果,none 其中 [=44] =].

至少找到了!

文档:NSComparisonPredicateOptions

typedef enum NSComparisonPredicateOptions : NSUInteger {
    NSCaseInsensitivePredicateOption = 0x01,      //==> [c]
    NSDiacriticInsensitivePredicateOption = 0x02, //==> [d]
    NSNormalizedPredicateOption = 0x04            //==> [n]
} NSComparisonPredicateOptions;

+ NSLocaleSensitivePredicateOption                //==> [l]

所以基本上 :
[c]:大写与小写相同(即:A == a)
[d]:带有 diacritics 的字符(尖音符、后音符等)与没有它的字符相同(即 à == a (accent)
[l]:这是针对本地化的特殊性。 Apple 示例以 "straße" 和 "strasse" 使用德语 "double s" (Eszett) 作为示例。