You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add FullTextTable class attribute & FullTextIndexed property attribute for easy FTS indexing
Add simple attribute support for full text indexing of a subset of columns in table as well as support to change the default tokenizer behavior [for the table. Porting a change that I did in a copy of SQLite.cs for a UWP Japanese dictionary app ~9 years ago that I'm now trying to port to MAUI. Added a bunch of unit tests to cover the functionality and confirmed the existing tests are all passing on Win11.
Example usage:
[FullTextTable]
public class Article
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[FullTextIndexed]
public string Title { get; set; }
[FullTextIndexed]
public string Content { get; set; }
public string Author { get; set; }
public DateTime PublishDate { get; set; }
}
[FullTextTable("JapaneseText_FT", "unicode61")]
public class JapaneseText
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[FullTextIndexed]
public string Text { get; set; }
public string Notes { get; set; }
}
varbeforeUpdateSql="CREATE TRIGGER IF NOT EXISTS \""+map.FullTextTableName+"_t_bu\" BEFORE UPDATE ON \""+map.TableName+"\" BEGIN\n"+deleteOldSql+"\nEND;";
988
+
Execute(beforeUpdateSql);
989
+
990
+
varbeforeDeleteSql="CREATE TRIGGER IF NOT EXISTS \""+map.FullTextTableName+"_t_bd\" BEFORE DELETE ON \""+map.TableName+"\" BEGIN\n"+deleteOldSql+"\nEND;";
991
+
Execute(beforeDeleteSql);
992
+
993
+
varafterUpdateSql="CREATE TRIGGER IF NOT EXISTS \""+map.FullTextTableName+"_t_au\" AFTER UPDATE ON \""+map.TableName+"\" BEGIN\n"+insertNewSql+"\nEND;";
994
+
Execute(afterUpdateSql);
995
+
996
+
varafterInsertSql="CREATE TRIGGER IF NOT EXISTS \""+map.FullTextTableName+"_t_ai\" AFTER INSERT ON \""+map.TableName+"\" BEGIN\n"+insertNewSql+"\nEND;";
997
+
Execute(afterInsertSql);
998
+
}
999
+
944
1000
returnresult;
945
1001
}
946
1002
@@ -2917,6 +2973,45 @@ public class StoreAsTextAttribute : Attribute
2917
2973
{
2918
2974
}
2919
2975
2976
+
publicenumFullTextSearchModule
2977
+
{
2978
+
FullTextSearch3=0,
2979
+
FullTextSearch4=1
2980
+
}
2981
+
2982
+
/// <summary>
2983
+
/// Attribute to specify a full-text search table created from a subset of the
2984
+
/// table columns. Name is the name of the FTS table, and Tokenizer is the tokenizer
2985
+
/// to use, which can be one of the built-in tokenizers: "simple", "porter", "unicode61", or (possibly) "icu".
FullTextTableTokenizer=fullTextTableAttr.Tokenizer!=null?fullTextTableAttr.Tokenizer:"unicode61";// The default "simple" tokenizer only supports ASCII so default to "unicode61" instead
3087
+
}
3088
+
2972
3089
varmembers=GetPublicMembers(type);
2973
3090
varcols=newList<Column>(members.Count);
2974
3091
foreach(varminmembers)
@@ -3075,6 +3192,15 @@ public Column[] InsertOrReplaceColumns {
0 commit comments