Developer forum

Forum » Ecommerce - Standard features » Facets fails when value contains comma

Facets fails when value contains comma

Kim Søjborg Pedersen
Reply

Hi I need an advize on how to setup my facets when comma is a part ot the product field value. I have tried with different setups (with and without the analyzed checkbox in the index field) but I don't have the right solution yet. The type of the fields is System.String


Replies

 
Nicolai Høeg Pedersen
Reply

When you say fails, what would that mean?

BR Nicolai

 
Kim Søjborg Pedersen
Reply

Hi Nicolai, apologies for the bad description. I mean that the result returnes empty if the querystring contains comma like this example  /Default.aspx?ProductDim1NotAnalyzed=+13%2C0+mm&groupid=9862&id=153 

 

 
Nicolai Høeg Pedersen
Reply

Are you URL escaping the character in the querystring? (encodeURIComponent in JS, UrlEncode in Razor)

Can I get a link to the solution so I can have a look?

 
Kim Søjborg Pedersen
Reply

I have send an e-mail. I can't reveals the solution just yet, sorry

 
Nicolai Høeg Pedersen
Reply

Hi Kim

Thank you. On your right side you have defined a parameter ProductDim1NotAnalyzed in the query - you have done that as an array. If you define a parameter as an array and assign it a value using commas, it will be split on the ,. So "25,0 mm" will be treated as "25" and "0 mm" when searched.

So you need to change the parameter to type string. See dump.

Issue is if you need to search both "25,0 mm" and "38,0 mm" - then you need something like this: ProductDim1NotAnalyzed=25,0 mm,38,0 mm and then DW cannot tell the difference between what is value delimiter and what is not.

NP

Capture.PNG
 
Kim Søjborg Pedersen
Reply

Hi Nicolai,

Okay thanks I see the challenge with comma. I think a solution could be to replace the comma with a punctuation in the import, and then place it again in the template so the user can select multiple values like this ...ProductDim1Analyzed=25.0+mm%2C38.0+mm

 
Nicolai Høeg Pedersen
Reply

ok.

We will make an alternative approach available in a later release for these kind of scenarios. I.e. [26,0][25,3] or 25,0;25,0

BR Nicolai

 
Jan Sangill
Reply

Hi Nikolai, I was wondering if as you mentioned in the last post - if this was made available in some way.

Otheriwse, I will, as the creator of the post have to do the same. Save "," as "." and then redo it in template.

Any help appreciated

//jan

 

 
Nicolai Pedersen
Reply

Hi Jan

You can do like this: [26,0][25,3]

 
Jan Sangill
Reply

Hi Nikolai, I just cant get that to work.

My set up is this:

Index:
MeasurementText3_Facet = System.String

Query Param:
MeasurementText3 = System.String[]

Query Expression:
MeasurementText3_Facet IN MeasurementText3 (param)

If I then call the index frontend with this:
?MeasurementText3=[219,1]
OR
?MeasurementText3=219,1

No products are returned.

Any ideas? 

 
Nicolai Pedersen
Reply

Can I see the setup of your MeasurementText3_Facet  field?

 
Jan Sangill
Reply

I have attached a screenshot

Screenshot_3.png
 
Morten Snedker Dynamicweb Employee
Morten Snedker
Reply

Hi Jan,

I have tested locally by creating a product text field. I have called the field MyMeasure. Then I have added a new field to the index, based on MyMeasure, and called it MeasureNotAnalyzed. So it is checked in "Stored" and checked in "Indexed". Leaving "Analyzed" unchecked.

I have added the MeasureNotAnalyzed to my query, having an "Equal" operator to an added a query parameter: measure

Lastly I have created a new facet (called Measure) that picks field "MeasureNotAnalyzed" and query paramater "measure".

I have set the value of my field on three products. One product has the value: 425,00 cm

The URL "http://precooked.local.dynamicweb.dk/standard?measure=425,00 cm" will return the one product with this value.

So, I get it to work. Let me have a comment.

/Snedker

 

 

You must be logged in to post in the forum