 | StringExtensionsGetSnippet Method (String, String) |
Gets a snippet for an attribute or a string.
Namespace:
SphinxConnector.FluentApi.Util
Assembly:
SphinxConnector (in SphinxConnector.dll) Version: 5.4.1
Syntaxpublic static string GetSnippet(
this string highlightSource,
string query
)
<ExtensionAttribute>
Public Shared Function GetSnippet (
highlightSource As String,
query As String
) As String
Parameters
- highlightSource
- Type: SystemString
The attribute or text to highlight. - query
- Type: SystemString
The query.
Return Value
Type:
StringThe highlighted text.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
String. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Examplesusing (IFulltextSession fulltextSession = fulltextStore.StartSession())
{
string query = "my query";
var results = fulltextSession.Query<Product>().
Match(query).
Select(product => new
{
product.Id,
product.Name,
Snippet = product.Description.GetSnippet(query)
}).ToList();
}
See Also