Gravatar for dipsindol@gmail.com

Question by DEEPTHI KATTA, Oct 31, 2016 8:53 PM

Facet on Custom Computed Date Time Field

Hi There, I followed steps below on creating an Archive Date Time Field https://developers.coveo.com/display/public/SitecoreV3/Creating+a+Computed+Date+Field

All is fine, I see the field on my index browser and was able to output it on to the UI using ToCoveoFieldName helper as well.

I am trying to Facet on this field, either the facet based on the field is not available on the dropdown or if it is, then no values coming up. Am I missing something? Is there is a specific field I will need to map the facet to?

  • Coveo For Sitecore - September components
  • Sitecore - 8.1 Update 2

Config Entry - For Computed Field

<field fieldName="archivedDate">zhsbs.ArchivedDateField, namespace.project</field>

Field Map to make it facettable

<fieldMap type="Coveo.SearchProvider.CoveoFieldMap, Coveo.SearchProvider">
  <fieldNames hint="raw:AddFieldByFieldName">
    <fieldType fieldName="archivedDate"  isFacet="true" isMultiValue="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
  </fieldNames>
</fieldMap>

I think I am doing everything right, could be I am missing something to make this facettable? It would help if there is a sample on how to make a computed datetime field facettable.

2 Replies
Gravatar for dipsindol@gmail.com

Answer by DEEPTHI KATTA, Nov 1, 2016 10:29 AM

Thanks to @jflheureux

A standard facet can never be applied to Datetime field. :) Which is why when I do the above , the dropdown does not contain the datetime computed field.

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Nov 2, 2016 8:38 AM

You are right:

  • The "Coveo Facet" component only lists string fields.
  • The "Coveo Facet Range" component will list datetime and numeric fields. -The "Coveo Facet Slider" component will list numeric fields only.
  • And finally, the "Coveo Facet Date Slider" component will only list datetime fields.

@dipsindol wanted to create a year facet. To do this, just do a Sitecore computed index field to extract the year in a new string field and use that field for the facet.

Gravatar for flguillemette@coveo.com

Answer by François Lachance-Guillemette, Nov 1, 2016 7:52 AM

Hi @Dipsindol :)

The fields visible in the dropdown are defined in the items placed in the "Facets" bucket, located under the "/sitecore/settings/Buckets/Facets" path.

You should add an item in this bucket matching the new computed field you added in your configuration.

These steps can be found in our documentation here.

FLG

Gravatar for dipsindol@gmail.com

Comment by DEEPTHI KATTA, Nov 1, 2016 10:14 AM

That is exactly what I did. added the facet with field matching with my config entry. In my case - archivedDate(Tried both lower case and exact string match). This field does not even show up on the drop down when I add a facet on my page. When would this happen? FYI, I see this new computed field on Index Browser and Custom Fields section on Configuration CES Admin console.

Ask a question