Instance Methodgrdb 7.3.0GRDB
tokenize(document:)
Tokenizes the string argument as a document that would be inserted into an FTS5 table.
func tokenize(document string: String) throws -> [(token: String, flags: FTS5TokenFlags)]
Parameters
- string
The string to tokenize.
Returns
An array of tokens and flags.
Throws
An error if tokenization fails.
For example:
let tokenizer = try db.makeTokenizer(.ascii())
try tokenizer.tokenize(document: "foo bar") // [("foo", flags), ("bar", flags)]
See also tokenize(query:)
.