I am lost as to where I add the facet definitions in the searchmeta pipline.
Here is a simplified example of my process
var searchBuilder = new SearchDefinitionBuilder<MyModel>();
var clauses = new List<SearchDefinition<MyModel>>();
I have a process the adds clauses based on data passed in, so to simplify the example here is one clause added to the filter with hard coded values:
clauses.Add(searchBuilder.Phrase("topic", "water"));
var compoundSearchDef = Builders<Product>.Search.Compound();
compoundSearchDef.Must(clauses);
var aggPipeline = new EmptyPipelineDefinition<MyModel>()
.AppendStage(PipelineStageDefinitionBuilder.SearchMeta<MyModel>(searchDefinition: compoundSearchDef, indexName: MySearchIndexName));
var aggResult = await collection.Aggregate(pipeline: aggPipeline).ToListAsync();
This works for getting the lower bounds count, but the facets return null, which makes sense, since I have not defined any. I just can’t seam to find where I add them in.
Here is a working example I am trying to port from atlas to c#
$searchMeta: {
index: defaults.graphIndex,
facet:{
operator: {
compound:{
must:defaults.aggregateFilters
}
},
facets: searchMetaFacets
}
}
This is the part I am stuck on converting to c# facets: searchMetaFacets