Gravatar for diego.moretto@xcentium.com

Question by Diego, Jan 27, 2015 2:05 PM

Index field type not working

Hello

I'm creating a computed field which is a Datetime but when I run the index it indexes as a string. It´s definition is set like this:

on the section of AddComputedIndexField: SBL.ContentSearch.ComputedFields.PrimaryDate, SBL

The method(PrimaryDate) that gets the field returns a nullable Datetime which I'm reading from a specifics fields withing sitecore and indexing it on a custom computed field. the value of the date is there but it gets indexes as a string a not a date time.

On the admin tool I see the computed field but as a string: @fprimarydate15406 String 2014/01/01@00:00:00

instead it should be looking like: Date/time 01/01/201412:00:00 AM

Any ideas on why it is getting indexed as a string and not by it´s type?

thanks

3 Replies
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Jan 28, 2015 8:45 AM

Based on the tutorial, you should add your computed field in the fields element, not the fieldnames element. You are mixing computed fields and field names. The two concepts are distinct: https://developers.coveo.com/display/SC201501/Understanding+the+Coveo+Search+Provider%27s+Configuration+File#UnderstandingtheCoveoSearchProvider'sConfigurationFile-ComputedFields

Gravatar for lbergeron@coveo.com

Answer by Luc Bergeron, Jan 27, 2015 2:18 PM

Hi,

Did you check this topic? https://developers.coveo.com/display/SC201501/Creating+a+Computed+Date+Field It explains pretty well how to do such a computed field. Make sure the value returned by your computed field has the right format.

Let me know how it goes.

Gravatar for diego.moretto@xcentium.com

Answer by Diego, Jan 27, 2015 5:02 PM

Based on the tutorial the return type of a date field should be "datetime"

I'm still not sure why that´s not working. It still indexes as a string and not a date time type

Ask a question