I have a field say birds name and I want to search all the birds which contain words.
public async Task<List<Bird>> GetBirdByName(string[] birdsName)
{
try
{
birdsName = birdsName.Select(x => x.ToLower()).ToArray();
FilterDefinition<Bird> filter = Builders<Bird>.Filter.In(r => r.BirdName, birdsName);
List<Bird> result = await _collection.Find(filter).ToListAsync();
return result;
}
catch (Exception ex)
{
await _logger.ExceptionLogAsync("BirdRepository.GetBirdByName", ex).ConfigureAwait(false);
}
return null;
}
I am not sure if this use the search index or not but I have created a search index on BirdName field and want to use it if it is not using it. Also how to check if my search index is being used or not?