Skip to content

Commit 81e2394

Browse files
committed
Update README and FTS5 Trigram
1 parent 50da7c8 commit 81e2394

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ with built-in [SQLCipher] and [Full-text search] extensions,
55
along with a [SQLiteDB] Swift package that provides
66
API parity with the venerable [SQLite.swift] project.
77

8-
This is a stand-along and platform-agnostic project, and
8+
This is a stand-alone and platform-agnostic project, and
99
does not presume the presence of any SQLite binary.
1010
It is therefore suitable for embedded projects or
11-
environments without any accessible `sqlite3.so` library (e.g., Android).
11+
environments without any accessible system `sqlite3`
12+
library (e.g., Android, Windows).
1213

1314
## Features
1415

Sources/SQLiteDB/Extensions/FTS4.swift

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,19 @@ public struct Tokenizer {
115115
return Tokenizer("unicode61", arguments)
116116
}
117117

118-
// https://sqlite.org/fts5.html#the_experimental_trigram_tokenizer
119-
public static func Trigram(caseSensitive: Bool = false) -> Tokenizer {
120-
Tokenizer("trigram", ["case_sensitive", caseSensitive ? "1" : "0"])
118+
// https://sqlite.org/fts5.html#the_trigram_tokenizer
119+
public static func Trigram(caseSensitive: Bool? = false, removeDiacritics: Bool? = nil) -> Tokenizer {
120+
var arguments = [String]()
121+
122+
if let caseSensitive {
123+
arguments.append("case_sensitive \(caseSensitive ? 1 : 0)")
124+
}
125+
126+
if let removeDiacritics {
127+
arguments.append("remove_diacritics \(removeDiacritics ? 1 : 0)")
128+
}
129+
130+
return Tokenizer("trigram", arguments)
121131
}
122132

123133
public static func Custom(_ name: String) -> Tokenizer {

0 commit comments

Comments
 (0)