word_search: filter input for FTS chars
This commit is contained in:
@@ -27,6 +27,18 @@ SearchMode _determineSearchMode(String word) {
|
||||
}
|
||||
}
|
||||
|
||||
/// FTS reacts to certain characters, so we should filter them out.
|
||||
String _filterFTSSensitiveCharacters(String word) {
|
||||
return word
|
||||
.replaceAll('-', '')
|
||||
.replaceAll('*', '')
|
||||
.replaceAll('+', '')
|
||||
.replaceAll('(', '')
|
||||
.replaceAll(')', '')
|
||||
.replaceAll('^', '')
|
||||
.replaceAll('\"', '');
|
||||
}
|
||||
|
||||
(String, List<Object?>) _kanjiReadingTemplate(
|
||||
String tableName,
|
||||
String word, {
|
||||
@@ -78,8 +90,8 @@ SearchMode _determineSearchMode(String word) {
|
||||
'''
|
||||
.trim(),
|
||||
[
|
||||
word,
|
||||
word,
|
||||
_filterFTSSensitiveCharacters(word),
|
||||
_filterFTSSensitiveCharacters(word),
|
||||
if (!countOnly) pageSize,
|
||||
word,
|
||||
if (!countOnly) pageSize,
|
||||
|
||||
Reference in New Issue
Block a user