Hi,
I have made a ProductIndexBuilderExtender to create a facet for 'In stock' true/false.
I renders fine as a facet, but when used (or added manually in the url) it always give 0 result.
Code:
public class ProductIndexBuilderExtender : IndexBuilderExtenderBase<ProductIndexBuilder>
{
    public override void ExtendDocument(IndexDocument indexDocument)
    {
        try
        {
           
            var productStockObj = indexDocument["ProductStock"];
         
            bool instock = false;
            if (productStockObj != null)
            {
                if (Double.TryParse(productStockObj.ToString(), out double productStock))
                {
                    instock = productStock > 0;
                }
                indexDocument.AddTermValue("ProductInStock", instock);
            }
        }
        catch (Exception e)
        {
            // log error
        }
    }
}
public static class IndexBuilderExtenderExtensions
{
    public static void AddTermValue(this IndexDocument document, string fieldName, object fieldValue)
    {
        if (!document.ContainsKey(fieldName))
        {
            document.Add(fieldName, fieldValue);
        }
        else
        {
            document[fieldName] = fieldValue;
        }
    }
}
The index:
The query: (it set to AND and the InStock is a boolean)
The facet:
what the facet renders:
The end of the url when filtered:
?InStock=%5BTrue%5D
Any ideas whats wrong?
BR Marie Louise