I am trying to build the lucene fulltext search with the wildcard expression to represent "Contains" /*.<Keyword>/*
, but in the Buildparameter model which is provided by the Azure Search library does not have the search properties.
I am using
Documents.Search<T>(searchTerm, searchParam);
//where SearchTerm is the <typed key search> for ex "Nurs" and the result
//should be where all or any text contains "Nurs"
The Azure.Search.Models SearchParameter which i am using to build is where i Extended to create the new class to contain the Search field.
return new ExtentedSearchParameter
{
IncludeTotalResultCount = true,
SearchFields = new List<string>() {"FilterableTitle", "FilterableAlternativeTitle"},
Skip = (properties.Page - 1) * properties.Count,
Top = properties.Count,
Search=properties.SearchQuery,
QueryType = QueryType.Full ,
Select=new List<string>(){"FilterableTitle", "FilterableAlternativeTitle"},
OrderBy = properties.OrderByFields,
};
and in my application I am building the query like
if (string.IsNullOrWhiteSpace(returnProperties.FilterBy))
{
returnProperties.SearchQuery =$"FilterableTitle: /.*'{cleanSearchTerm.TrimStart('\"').TrimEnd('\"')}.*/' and FilterableAlternativeTitle:/.*'{cleanSearchTerm.TrimStart('\"').TrimEnd('\"')}.*/'";
}
When I am passing the searchparameter and the search term its not returning the result and its throwing an exception.