Why is facet not working?

In my C# I have this:

AlgoliaClient client = new AlgoliaClient(AlgoliaAppId, AlgoliaSecret);
String sourceDataIndexName = "test_posts";
Index index = client.InitIndex(sourceDataIndexName);
Query query = new Query("").SetFacets(new string[] { "label", "Strategies" });
IndexIterator res = index.BrowseAll(query);

When I run this code, I get 1533 records returned which is the number of all records in my index. But there are only 50 “Strategies” and so, I am expecting only 50 records.

When I use the interface and select “Strategies” for the “label” facet, I get only 50 records as expected.

Can anybody tell me what is wrong here?


I found this after looking at a lot of Google results:

Query query = new Query("").SetFacetFilters(new string { “label: Strategies” });

This returns the 50 that I expect to see.

1 Like