Developer forum

Forum » CMS - Standard features » nex index - default = false, if true equal empty

nex index - default = false, if true equal empty

Nuno Aguiar
Reply

Hi,

 

We have a boolean to flag products. What I need is to list all products where the false is unchecked (so far that is simple), but when I click a facet (checkbox) I want to list all products (both flagged and unflagged).

 

How can I get this to work?

 

Best Regards,

Nuno Aguiar


Replies

 
Nuno Aguiar
Reply

Hi,

 

I re-read my initial comments and let me rephrase. We have a (boolean) parameter we need to default to False, but through a Facet I want to "disable" that parameter, so I get products with both True and False.

 

How do I do that?

 

Best Regards,

Nuno Aguiar

 
Nicolai Høeg Pedersen
Reply

In your query, include the field in the search with a "Match Any", create the parameter (as a boolean) and set the default value to false.

You should not create a facet - that would give you a list of values (True, False). You need to make a hardcoded checkbox with the value=True,False - when the checkbox is set, you add &param=True,False to the querystring.

Nicolai

 
Nuno Aguiar
Reply

Nevermind...

 

I changed the parameter from Boolean to Boolean Array and changed the query operator to match any, The Facet will send both true and false :)

 

Nuno Aguiar

 
Nuno Aguiar
Reply

Hi Nicolai,

 

Thanks for your comment. When I started answering your post hadn't came through. 

 

Best Regards,

Nuno Aguiar

 

You must be logged in to post in the forum