FieldMappingFunction.ExtractTokenAtPosition(String, Int32) 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.
Creates a field mapping function that splits a string field using the specified delimiter, and picks the token at the specified position in the resulting split.
public static Microsoft.Azure.Search.Models.FieldMappingFunction ExtractTokenAtPosition (string delimiter, int position);
static member ExtractTokenAtPosition : string * int -> Microsoft.Azure.Search.Models.FieldMappingFunction
Public Shared Function ExtractTokenAtPosition (delimiter As String, position As Integer) As FieldMappingFunction
Parameters
- delimiter
- String
A string to use as the separator when splitting the input string.
- position
- Int32
An integer zero-based position of the token to pick after the input string is split.
Returns
A new field mapping function.
Remarks
For example, if the input is Jane Doe, the delimiter is " " (space) and the position is 0, the result is Jane; if the position is 1, the result is Doe. If the position refers to a token that doesn't exist, an error will be returned.
Sample use case: Your data source contains a PersonName field, and you want to index it as two separate FirstName and LastName fields. You can use this function to split the input using the space character as the delimiter.
Applies to
Azure SDK for .NET