File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,25 @@ public struct FTS5Pattern: Sendable {
123123 try ? self . init ( rawPattern: " ^ \" " + tokens. joined ( separator: " " ) + " \" " )
124124 }
125125
126- init ( rawPattern: String , allowedColumns: [ String ] = [ ] ) throws {
126+ /// Creates a pattern from a raw pattern string.
127+ ///
128+ /// The pattern syntax is documented at <https://www.sqlite.org/fts5.html#full_text_query_syntax>
129+ ///
130+ /// For example:
131+ ///
132+ /// ```swift
133+ /// // OK
134+ /// let pattern = try FTS5Pattern(rawPattern: "and")
135+ ///
136+ /// // Throws an error: malformed MATCH expression: [AND]
137+ /// let pattern = try FTS5Pattern(rawPattern: "AND")
138+ /// ```
139+ ///
140+ /// If the pattern tests for specific columns, you must pass those
141+ /// columns in the `allowedColumns` parameter.
142+ ///
143+ /// - throws: A ``DatabaseError`` if the pattern has an invalid syntax.
144+ public init ( rawPattern: String , allowedColumns: [ String ] = [ ] ) throws {
127145 // Correctness above all: use SQLite to validate the pattern.
128146 //
129147 // Invalid patterns have SQLite return an error on the first
You can’t perform that action at this time.
0 commit comments