I have a below code which should return all the names starting with T&S from azure index for example the results should be like below
- T&S
- T&S Limited
- T&S Corporation
The search text we see in the code is the UrlEncoded version of "T&S*"
Search Code Block
var response = await _searchClient.Documents.SearchAsync<customDto>("%22T%26S%22*",
new SearchParameters
{
SearchFields = new List<string> { "Name" },
SearchMode = SearchMode.All
});
Custom DTO
public class CustomDto{
public CustomDto(int id,string name)
{
Id=Convert.ToString(id),
Name=name
}
[IsSearchable, IsFilterable]
[System.ComponentModel.DataAnnotations.Key]
public string Id { get; }
[IsSearchable, IsFilterable, IsSortable]
public string Name {get;}
}
Now, If i put the similar search text on the azure search query window i get results as expected %22T%26S%22*&searchMode=all&searchFields=Name
But for some reason the code returns empty result. I dont get what am i doing wrong here.
Please assist.
Thank you