Developer forum

Forum » Ecommerce - Standard features » Facet Options for Int32 fields

Facet Options for Int32 fields

Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi,

 

I am running on 9.6.3 and have a Repository with custom product fields, where one is of type integer (Int32). We call it "Minimum seats".

 

We then created a facet and tried to get facet options from that field, but got none. Shouldn't the Repository properly process int32 fields?

 

We had to create a custom index field of type string and use that field instead, just to get the proper facet options.

 

Best Regards,

Nuno Aguiar


Replies

 
Tomas Gomez
Reply

Hi Nuno,

Same problem here. We have a custom product field "Diametro" defined as Integer, with a query parameter of type Int32[] and its facet as checkboxes (I attach screenshots with the configuraton)

The facet is not displayed, despite this product field has several values indexed.

Is it needed to extend the index with a custom field or is there any other solution? Can you provide more info?

Regards, and happy Xmas!
Tomas

Captura1.PNG Captura2.PNG Captura3.PNG
 
Nicolai Pedersen
Reply

Hi Both

This has to do with the way Lucene handles numeric fields. We did make some changes in how we handle integers in facets and searches in 9.7 - so take a look at the latest 9.7 build and see if that will work for you.

BR Nicolai

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

We upgraded to 9.7.2 a while back and the issue still remains. I know there's 9.7.5 now, but I haven't tried it yet.

 

Best Regards,

Nuno Aguiar

 
Tomas Gomez
Reply

Hi,

Thanks for the fast response :-)

Same for us, we use 9.7.2 and cannot display the integer facets

BR, Tomas

 
Tomas Gomez
Reply

Hi Nicolai and Nuno,

I installed a local 9.7.5 solution and set the above configuration.

There is an error, no products are shown when displaying the product page. I checked the product feed adding "?feed=true" to the URL and this error is shown:

An error occurred while attaching module (Dynamicweb.Frontend.Content)<br><br><pre>System.InvalidCastException: Specified cast is not valid.
   at Dynamicweb.Indexing.Lucene.LuceneIndexProvider.FillFacetResultUsingSpecializedQuery(Facet facet, FieldDefinitionBase field, IndexReader reader, Query searchQuery, QuerySettings settings, FacetGroupResult facetsResult, IList`1 exceptions)
   at Dynamicweb.Indexing.Lucene.LuceneIndexProvider.DoFacetSearch(IFacetGroup facets, FieldDefinitionBase[] fields, IndexReader reader, IQuery query, QuerySettings settings, Query originalQuery, IList`1 exceptions)
   at Dynamicweb.Indexing.Lucene.LuceneIndexProvider.SearchInternal(IQuery query, QuerySettings settings)
   at Dynamicweb.Indexing.Querying.QueryService.Query(IQuery query, QuerySettings settings)
   at Dynamicweb.Ecommerce.Frontend.Frontend.GetProductsFromIndexQuery(ProductCatalogShowType settingsType)
   at Dynamicweb.Ecommerce.Frontend.Frontend.EcomRender()
   at Dynamicweb.Ecommerce.Frontend.Frontend.GetContent()
   at Dynamicweb.Frontend.Content.GetModuleOutput(Paragraph paragraph, PageView pageview)</pre>

Is there any trick we could do to solve this error?  ...or how could we implement the integer facets?

Regards, Tomas

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Tomas,

 

In our case we created a new index field of type string (not analyzed). Since we don't need any sort of range or integer calculations like lower than, it was good enough.

 

Best Regards,

Nuno Aguiar

 
Tomas Gomez
Reply

Thanks Nuno!

It works perfect for our needs as well :-)

 

You must be logged in to post in the forum