Lingua

SqlServerQueryableExtensions.ContainsTable<T,TKey> Method

Definition

Queries a full-text index using the SQL Server CONTAINSTABLE function.

public static System.Linq.IQueryable<Microsoft.EntityFrameworkCore.Query.FullTextSearchResult<TKey>> ContainsTable<T,TKey>(this Microsoft.EntityFrameworkCore.DbSet<T> source, string searchCondition, System.Linq.Expressions.Expression<Func<T,object>>? columnSelector = default, string? languageTerm = default, int? topN = default) where T : class;
static member ContainsTable : Microsoft.EntityFrameworkCore.DbSet<'T (requires 'T : null)> * string * System.Linq.Expressions.Expression<Func<'T, obj>> * string * Nullable<int> -> System.Linq.IQueryable<Microsoft.EntityFrameworkCore.Query.FullTextSearchResult<'Key>> (requires 'T : null)
<Extension()>
Public Function ContainsTable(Of T As Class, TKey As Class) (source As DbSet(Of T), searchCondition As String, Optional columnSelector As Expression(Of Func(Of T, Object)) = Nothing, Optional languageTerm As String = Nothing, Optional topN As Nullable(Of Integer) = Nothing) As IQueryable(Of FullTextSearchResult(Of TKey))

Type Parameters

T

The entity type being queried.

TKey

The type of the full-text key column.

Parameters

source
DbSet<T>

The DbSet<TEntity> representing the table with the full-text index.

searchCondition
String

The search condition, supporting full-text predicates like AND, OR, NEAR, etc.

columnSelector
Expression<Func<T,Object>>

An optional selector for the column(s) to search. Can be a single property (e.g., e => e.Title) or multiple properties via an anonymous type (e.g., e => new { e.Title, e.Body }). When omitted, all full-text indexed columns are searched.

languageTerm
String

Optional language term from sys.syslanguages for word-breaking.

topN
Nullable<Int32>

Optional maximum number of results to return.

Returns

An IQueryable<T> of FullTextSearchResult<TKey> containing the key and rank of matching rows.

Remarks

Use the Key property to join back to the original table to retrieve the full entity data.

See SQL Server documentation for CONTAINSTABLE for more information.

Applies to