Clarify FTS5Pattern(matchingPrefixPhrase:) behavior

This commit is contained in:
Gwendal Roué committed 2021-01-20 07:51:00 +01:00
1 parent 8fe3d41d18
commit befeb07234
1 file changed
+7 -4
+7 -4
View File
@@ -56,11 +56,14 @@ public struct FTS5Pattern {
try? self.init(rawPattern: "\"" + tokens.joined(separator: " ") + "\"")
}
/// Creates a pattern that matches a contiguous string prefix; returns
/// nil if no pattern could be built.
/// Creates a pattern that matches the prefix of an indexed document;
/// returns nil if no pattern could be built.
///
/// FTS5Pattern(matchingPrefixPhrase: "") // nil
/// FTS5Pattern(matchingPrefixPhrase: "foo bar") // ^"foo bar"
/// FTS5Pattern(matchingPrefixPhrase: "") // nil
/// FTS5Pattern(matchingPrefixPhrase: "the word") // ^"the word"
///
/// This pattern matches a prefix made of full tokens: "the bat" matches
/// "the bat is happy", but not "mind the bat", or "the batcave is dark".
///
/// - parameter string: The string to turn into an FTS5 pattern
public init?(matchingPrefixPhrase string: String) {