 | IFulltextSessionBuildSnippetsAsyncTDocument(IEnumerableString, String) Method |
Builds snippets for the given data using the text processing settings from the index for the given
document type.
Namespace: SphinxConnector.FluentApiAssembly: SphinxConnector (in SphinxConnector.dll) Version: 6.0.0
SyntaxTask<IList<string>> BuildSnippetsAsync<TDocument>(
IEnumerable<string> data,
string query
)
Function BuildSnippetsAsync(Of TDocument) (
data As IEnumerable(Of String),
query As String
) As Task(Of IList(Of String))
Parameters
- data IEnumerableString
- The data to build snippets for.
- query String
- The query to build snippets for.
Type Parameters
- TDocument
- The document type.
Return Value
TaskIListStringA list of strings with the snippets.
Exceptions
Example
Suppose you have the following class representing a document in your index:
using (IFulltextSession fulltextSession = fulltextStore.StartSession())
{
var results = await fulltextSession.Query<Product>().
Match("my query").
ToListAsync();
var descriptionSnippets = await fulltextSession.BuildSnippetsAsync<Product>(results.Select(p => p.Description), "my query");
}
See Also