I need a way to control building a facet without only using the nest fluent api. The main need is that I may need to include or exclude allterms or facetfilters.
The code below works but to change the facet, I would need to recompile. I see that it takes a Func but I have been unable to return the correct type to get this working.
sd.FacetTerm("Name", t => t
.OnField("Field")
.Size(facet.Size)
.AllTerms()
);
The code below doesn’t work and I’m sure why. When debugging, I see that it creates the facet term but without any of the data that “FacetBuilder” provided.
sd.FacetTerm(facet.Name, t => FacetBuilder(options));
public TermFacetDescriptor<CatalogMapping> FacetBuilder(FacetOptions options)
{
var facet = new TermFacetDescriptor<CatalogMapping>();
facet.OnField(options.Field);
facet.Size(options.Size);
if (options.IncludeAllTerms)
facet.AllTerms();
return facet;
}
Need to pass an object reference and modify that instance.