-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FTS extensions #1649
FTS extensions #1649
Conversation
…te just SqlField's PhysicalName.
…c queries safely.
List of new extesions (for naming schema review). MySQL: // MATCH AGAINST as predicate
Sql.Ext.MySql().Match(search, params[] columns)
Sql.Ext.MySql().Match(modifier, search, params[] columns) // MATCH AGAINST as relevance
Sql.Ext.MySql().MatchRelevance(search, params[] columns)
Sql.Ext.MySql().MatchRelevance(modifier, search, params[] columns) |
SQLite: // match(table) and match(column)
Sql.Ext.SQLite().Match(entityOrColumn, search);
Sql.Ext.SQLite().MatchTable(table, search);
// hidden columns
Sql.Ext.SQLite().RowId(table);
Sql.Ext.SQLite().Rank(table); FTS3 and FTS5 functions: // FTS3
Sql.Ext.SQLite().FTS3Offsets(table);
Sql.Ext.SQLite().FTS3MatchInfo(table);
Sql.Ext.SQLite().FTS3MatchInfo(table, format);
Sql.Ext.SQLite().FTS3Snippet(table);
Sql.Ext.SQLite().FTS3Snippet(table, startMatch);
Sql.Ext.SQLite().FTS3Snippet(table, startMatch, endMatch);
Sql.Ext.SQLite().FTS3Snippet(table, startMatch, endMatch, ellipses);
Sql.Ext.SQLite().FTS3Snippet(table, startMatch, endMatch, ellipses, columnIndex);
Sql.Ext.SQLite().FTS3Snippet(table, startMatch, endMatch, ellipses, columnIndex, tokensNumber);
// FTS5
Sql.Ext.SQLite().FTS5bm25(table);
Sql.Ext.SQLite().FTS5bm25(table, params[] weights);
Sql.Ext.SQLite().FTS5Highlight(table, columnIndex, startMatch, endMatch);
Sql.Ext.SQLite().FTS5Snippet(table, columnIndex, startMatch, endMatch, ellipses, tokensNumber); FTS3 and FTS5 commands (DataConnection extensions): // FTS3
dc.FTS3Optimize(table);
dc.FTS3Rebuild(table);
dc.FTS3IntegrityCheck(table);
dc.FTS3Merge(table, blocks, segments);
dc.FTS3AutoMerge(table, segments);
// FTS5
dc.FTS5AutoMerge(table, value);
dc.FTS5CrisisMerge(table, value);
dc.FTS5Delete(table, rowid, record);
dc.FTS5DeleteAll(table);
dc.FTS5IntegrityCheck(table);
dc.FTS5Merge(table, value);
dc.FTS5Optimize(table);
dc.FTS5Pgsz(table, value);
dc.FTS5Rank(table, function);
dc.FTS5Rebuild(table);
dc.FTS5UserMerge(table, value); |
SQL Server: // FREETEXTTABLE(table, *, ...)
Sql.Ext.SqlServer().FreeTextTable(table, search);
Sql.Ext.SqlServer().FreeTextTable(table, search, top);
Sql.Ext.SqlServer().FreeTextTableWithLanguage(table, search, top, language_name);
Sql.Ext.SqlServer().FreeTextTableWithLanguage(table, search, top, language_name, top);
Sql.Ext.SqlServer().FreeTextTableWithLanguage(table, search, top, language_code);
Sql.Ext.SqlServer().FreeTextTableWithLanguage(table, search, top, language_code, top);
// FREETEXTTABLE(table, (columns), ...)
Sql.Ext.SqlServer().FreeTextTable(table, columns_expr, search);
Sql.Ext.SqlServer().FreeTextTable(table, columns_expr, search, top);
Sql.Ext.SqlServer().FreeTextTableWithLanguage(table, columns_expr, search, top, language_name);
Sql.Ext.SqlServer().FreeTextTableWithLanguage(table,, columns_expr search, top, language_name, top);
Sql.Ext.SqlServer().FreeTextTableWithLanguage(table, columns_expr, search, top, language_code);
Sql.Ext.SqlServer().FreeTextTableWithLanguage(table, columns_expr, search, top, language_code, top);
// CONTAINSTABLE(table, *, ...)
Sql.Ext.SqlServer().ContainsTable(table, search);
Sql.Ext.SqlServer().ContainsTable(table, search, top);
Sql.Ext.SqlServer().ContainsTableWithLanguage(table, search, top, language_name);
Sql.Ext.SqlServer().ContainsTableWithLanguage(table, search, top, language_name, top);
Sql.Ext.SqlServer().ContainsTableWithLanguage(table, search, top, language_code);
Sql.Ext.SqlServer().ContainsTableWithLanguage(table, search, top, language_code, top);
// CONTAINSTABLE(table, (columns), ...)
Sql.Ext.SqlServer().ContainsTable(table, columns_expr, search);
Sql.Ext.SqlServer().ContainsTable(table, columns_expr, search, top);
Sql.Ext.SqlServer().ContainsTableWithLanguage(table, columns_expr, search, top, language_name);
Sql.Ext.SqlServer().ContainsTableWithLanguage(table,, columns_expr search, top, language_name, top);
Sql.Ext.SqlServer().ContainsTableWithLanguage(table, columns_expr, search, top, language_code);
Sql.Ext.SqlServer().ContainsTableWithLanguage(table, columns_expr, search, top, language_code, top);
// FREETEXT(table.*, ..)
Sql.Ext.SqlServer().FreeText(table, search);
Sql.Ext.SqlServer().FreeTextWithLanguage(table, search, language_name);
Sql.Ext.SqlServer().FreeTextWithLanguage(table, search, language_code);
// FREETEXT((columns), ..)
Sql.Ext.SqlServer().FreeText(table, search, param[] columns);
Sql.Ext.SqlServer().FreeTextWithLanguage(table, search, language_name, param[] columns);
Sql.Ext.SqlServer().FreeTextWithLanguage(table, search, language_code, param[] columns);
// CONTAINS(table.*, ..)
Sql.Ext.SqlServer().Contains(table, search);
Sql.Ext.SqlServer().ContainsWithLanguage(table, search, language_name);
Sql.Ext.SqlServer().ContainsWithLanguage(table, search, language_code);
// CONTAINS((columns), ..)
Sql.Ext.SqlServer().Contains(table, search, param[] columns);
Sql.Ext.SqlServer().ContainsWithLanguage(table, search, language_name, param[] columns);
Sql.Ext.SqlServer().ContainsWithLanguage(table, search, language_code, param[] columns);
// CONTAINS(PROPERTY())
Sql.Ext.SqlServer().ContainsProperty(column, property, search);
Sql.Ext.SqlServer().ContainsPropertyWithLanguage(column, property, search, language_name);
Sql.Ext.SqlServer().ContainsPropertyWithLanguage(column, property, search, language_code); |
# Conflicts: # Tests/Tests.Playground/Tests.Playground.csproj
This is ready for review. |
/// <param name="columns">Full-text columns that should be queried.</param> | ||
/// <returns>Returns <c>true</c> if full-text search found matching records.</returns> | ||
[Sql.Extension("MATCH({columns, ', '}) AGAINST ({search})", IsPredicate = true, ServerSideOnly = true)] | ||
public static bool Match(this IMySqlExtensions ext, [ExprParameter("search")] string search, [ExprParameter("columns")] params object[] columns) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no one place. But name of parameter is not required - original parameter name will be used
/// </summary> | ||
public partial class TestDataDB : LinqToDB.Data.DataConnection | ||
public partial class TestData2014DB : LinqToDB.Data.DataConnection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we have to set name of DataConnection class explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
Whoops, forgot to address review comments, will do in master |
fix #1561
(maybe) [PostgreSQL] FTS extensionspostponed till user requestSummary:
FreeTextTableExpressionAttribute
extension attribute andSql.FreeText()
extensionGenerateSqlServerFreeText
option tofalse
to avoid obsoletedFreeTextTableExpressionAttribute
-related FTS code generationFreeTextTableExpressionAttribute
is still broken and we don't plan to fix it)