Developer forum

Forum » Ecommerce - Standard features » Facets of searched products

Facets of searched products

Tomas Gomez
Reply

Hi,

When searching a word, the product page shows facets that should not appear. That is, facets of category fields not related with the displayed products.

Does anybody have a clue about how to control these facets? They have to be shown on certain categories, but not when there are no related products.

Regards,
Tomas


Replies

 
Nicolai Pedersen
Reply

You probably have some code that removes products from the search result before rendering them. And the facets have values from the removed products. That is my guess.

 
Tomas Gomez
Reply

Thanks Nicolai

I did some tests and it is not an issue from removed products. The issue is with displayed products.

  • All facets are checkboxes.
  • The wrong facets are displayed because they show the FALSE option. The problem is that they are considering a FALSE value for products that doesn't have that field. This way, when selecting the FALSE option on the facet, the list displays products that hasn't that field.
  • I tested adding a product to a group of a category that has a problematic field. When setting TRUE for that field the facet show the TRUE option. But after removing the product from the group, the facet again includes the product on its FALSE option (the product should not be included in the facet, as the product doesn't have that field anymore)
  • The Monitoring > Health > Ecommerce data show no errors.
  • I rebuilt the repositories, to ensure data synchronization of the products.

 Any other suggestion to test?

Regards,
Tomas

 
Tomas Gomez
Reply

I checked some other things:

  • In the query, the parameter (of the field linked to the wrong facets) has no default value. It could happend that a default FALSE value would make those facets to appear for the products that has not that field.
  • For the products added wrongly to the facet (ie. products that doesn't have the field of the facet)
    • In backend, the product doesn't have that field, neither in Ecom nor in PIM modules
    • In frontend, the TemplateTags() show that the product hasn't that field.

This reinforces the theory that is an issue of the facets, not an issue of the products. 

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply
This post has been marked as an answer

Hi Thomas,

 

I has similar issues and I solved them by creating a Facet List (instead of a Facet Field or Facet Term). Please check my comment in http://doc.dynamicweb.com/forum/rapido/rapido/facets-showing-products-with-filed-value-false for a workable solution.

 

Best Regards,

Nuno Aguiar

Votes for this answer: 1
 
Tomas Gomez
Reply

Hi Nuno!

I added a List facet with only the True option (see image 1). This way, both Field facet and List facet are displayed with a duplicated False option (see image 2)

To avoid duplicity, I removed the original Field facet. This way the List facet is never displayed, not even when products with that field are available (some products with True and some others with False value)

Does this happened to you before?

Regards,
Tomas

 

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Thomas,

 

This happens when you have 2 facets associated with the same Field. Delete one and see if that works.

 
Tomas Gomez
Reply

Hi Nuno,

Yes, but the problem is that the List facet is not displayed when I delete the Field Facet. That is:

  • If there are the List and the field facets, then the options are duplicated.
  • If there is only the List facet, then the facet is not displayed

it is a weird behaviour because the search term (ie. the URL) is the same in both cases.

Do you know why the List facet is not showing? Does it have any dependence on any other configuration?

Regards,
tomas

 

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Tomas,

 

Isn't that what you needed? That the list facet did not show when there are no "True" options?

 

The particularity with boolean fields is that they are not nullable booleans, so in the database null=false and unchecked=false, so they are all indexed the same way. This means you only really have 2 options; true or false. Using the technique of the List Facet, you get the Facet to only show up when there's at least 1 product with the value of "true" (the value shoulb be "true" but you can also try with "1").

 

If you need "nullable booleans", then you need to change this field to a dropdown field that have 2 options (true/false) and index them as text, so that "empty" does not match "false" when indexing.

 

Hope that makes sense.

 

Best Regards,

Nuno Aguiar

 
Tomas Gomez
Reply

Hi Nuno,

Sorry, I meant that the facet didn't appear even when there were products with that field set to True. But it was my mistake because a misconfiguration of the parameters.

So I finally could set it up, and it works great :-)

Thanks a lot for the trick, Nuno!

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Perfect. You are welcome

 

You must be logged in to post in the forum