FTS5Tokenizer
public protocol FTS5Tokenizer
An interface to a custom FTS5 tokenizer.
-
Initializes an FTS5 tokenizer.
Declaration
Swift
init(arguments: [String])Parameters
argumentsThe tokenizer arguments used to create the FTS5 table.
-
Sets the text to be tokenized.
Declaration
Swift
func setText(_ text: String, reason: Database.FTS5TokenizationReason)Parameters
textThe text to be tokenized.
reasonThe reason tokenization is being requested.
-
Advances the tokenizer to the next token.
Declaration
Swift
func advance() -> BoolReturn Value
trueif a token was found,falseotherwise -
Returns the current token.
Declaration
Swift
func currentToken() -> String?Return Value
The current token or
nilif none -
Copies the current token in UTF-8 to the supplied buffer.
Throws
An error if
bufferhas insufficient capacity for the tokenDeclaration
Swift
func copyCurrentToken(to buffer: UnsafeMutablePointer<UInt8>, capacity: Int) throws -> IntParameters
bufferA buffer to receive the current token encoded in UTF-8
capacityThe number of bytes availabe in
bufferReturn Value
The number of bytes written to
buffer
View on GitHub
FTS5Tokenizer Protocol Reference