From befeb072345aa403b84e8cdaa39a422d6af442c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Wed, 20 Jan 2021 07:51:00 +0100 Subject: [PATCH] Clarify FTS5Pattern(matchingPrefixPhrase:) behavior --- GRDB/FTS/FTS5Pattern.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/GRDB/FTS/FTS5Pattern.swift b/GRDB/FTS/FTS5Pattern.swift index 53ce4ac3c..86f90b7f7 100644 --- a/GRDB/FTS/FTS5Pattern.swift +++ b/GRDB/FTS/FTS5Pattern.swift @@ -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) {