SqlServerQueryableExtensions.WithApproximate<T> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Enables approximate nearest neighbor (ANN) search for a vector search query. This causes WITH APPROXIMATE to
be added to the SQL TOP clause, instructing SQL Server to use the vector index for better performance.
[System.Diagnostics.CodeAnalysis.Experimental("EF9105")]
public static System.Linq.IQueryable<T> WithApproximate<T>(this System.Linq.IQueryable<T> source);
[<System.Diagnostics.CodeAnalysis.Experimental("EF9105")>]
static member WithApproximate : System.Linq.IQueryable<'T> -> System.Linq.IQueryable<'T>
<Extension()>
Public Function WithApproximate(Of T) (source As IQueryable(Of T)) As IQueryable(Of T)
Type Parameters
- T
Parameters
- source
- IQueryable<T>
Returns
- Attributes
Remarks
This method must be called after Take(...) to specify the number of results. Without WithApproximate, vector search performs an exact k-nearest neighbor (kNN) search without using the vector index.