I am trying to write script using examine fluent api.
I have conditions that I need to fulfill
- search must find nodes starting with searchTerm
- search must find nodes containing searchTerm
- search must find nodes ending with searchTerm
- search must support multiple words
- search must not fail due to & * ` and another characters
I am able to match only words starting with this string.
When I execute to code below, I do get only words starting with the searchTerm
public IEnumerable<SearchResultItem> Search(string searchTerm)
{
//Create search Criteria
var sc = ExamineManager.Instance.CreateSearchCriteria();
//define query
var query = sc.NodeName(searchTerm.MultipleCharacterWildcard())
.Or()
.Field("content", searchTerm.MultipleCharacterWildcard())
.Compile();
var results = ExamineManager.Instance.SearchProviderCollection["ContentSearcher"].Search(query);
return results.OrderBy(x => x.Score).Select(MapSearchResults);
}
How do I update the search script for all conditions?