I have been using the Aggregate().SearchMeta to get facets. I have a scenario, where I now need to narrow down the search to a specific set of records based on id.
for example this is what I am trying to accomplish:
var idFilter = Builders<TProduct>.Filter.In(x => x.Id, aListOfStringIds); var aggResultArray = await Repository.Aggregate() .SearchMeta(Builders<TProduct>.Search .Facet(Builders<TProduct>.Search .Compound().Filter(idFilter) .Must(must) .Should(should), facets), indexName: SearchIndex) .ToListAsync(cancellationToken);
The problem I am running in to, is that idFilter is of type FilterDefinition, and .Filter() requires a type SearchDefinition. I tried using the SearchDefinition.QueryString and set the query to OR the ids, but it does not result in any matches. My guess is it is because my Id field is an ObjectId and querystring is doing a string comparision.