Expose FTS5Pattern initializer for raw pattern.#1050
Expose FTS5Pattern initializer for raw pattern.#1050GetToSet wants to merge 1 commit intogroue:developmentfrom
Conversation
aa8efd3 to
7ce0c5c
Compare
7ce0c5c to
e3ea8cc
Compare
|
Hello @GetToSet, Thank you for your contribution. I won't be able to review your pull request until mid September. Please be patient. |
|
Hello @GetToSet, I do not quite understand what feature is made possible with this pull request. Would you please explain what you need? |
|
The main purpose of this PR is to make |
|
Thanks @GetToSet, but "because FTS3 can" is not a reason. FTS5 is not FTS3, and FTS5 pattern validation is not the same as FTS3 pattern validation (FTS5 cares about tables and columns when FTS3 does not). You have to find a better argument. For example, tell about what you can't possibly do, without any known workaround? |
|
My use cases contain prefix queries like While using FTS3, I use the |
Or maybe I can enhance current tokenization process to correctly support prefix tokens rather than exposing |
|
Now we're talking :-) It happens I had a similar conversation with one of my coworker yesterday, and I pushed on the development branch four new APIs:
The two new initializers accept user input and turn "foo bar" into the The two You still need a database connection in order to call |
Those methods accept a tokenizer: // Default tokenization using the `ascii` tokenizer:
try FTS5.tokenize("SQLite database") // ["sqlite", "database"]
try FTS5.tokenize("Gustave Doré") // ["gustave", "doré"])
// Tokenization with an explicit tokenizer:
try FTS5.tokenize("SQLite database", withTokenizer: .porter()) // ["sqlite", "databas"]
try FTS5.tokenize("Gustave Doré", withTokenizer: .unicode61()) // ["gustave", "dore"])They currently do not accept a custom FTS5 tokenizer - I'll have to make it possible. |
|
Thanks I'll checkout the latest development branch to have a try. |
Note that a database connection is needed for FTS5 tokenization. |
|
@GetToSet I'm closing this PR because it will not be merged. But you can provide feedback about the new APIs, of course. They are not merged into master yet, so we can discuss them. |
Pull Request Checklist
developmentbranch.FTS3Patternas an initializerpublic init(rawPattern: String) throwsthat constructs it directly from raw pattern, whileFTS5Patterncan be constructed usingDatabaseextensions, makingpublic init(rawPattern: String, allowedColumns: [String] = []) throwspublicly available helps make it constructed easier outside a database-agnostic context.This PR also compared
FTS3Pattern.swiftwithFTS5Pattern.swift, and made some minor adjustments to make it easier to those APIs aligned up.