You were totally right to add
attributesForFaceting, this is the first and very important step. Without that, it’s not possible to filter on
For your specific question we have some documentation on the subject here but there are different ways of doing it. As I see you already have defined a
searchFunction and thus have access to the
helper, we are going to re-use that:
searchFunction method, you just need to add
helper.addFacetRefinement('ApprovalFL', true); before the
.search() call and you should be good to go.
Also note that it is not possible to do a filter on a
null value, so if you ever want to filter on all elements that are not approved, I would suggest replacing
false and use that for filtering.
Edit: I also see you posted a similar question on Stack Overflow and got an other way of doing it. All those ways are valid, they are all doing the same thing. As suggested on SO, I would advise you to either pick
searchFunction, though, it will make the code easier to understand.
Hope that helps!