Gravatar for loebrandy@gmail.com

Question by rloeb, Dec 6, 2016 9:09 PM

We have templateid and _template fields but sometimes _template is missing?

We usually see both @ftemplateid and @z95xtemplate in our sitecore sources, and built some queries around @z95xtemplate.

We recently noticed that some Items were missing @z95xtemplate despite having @ftemplateid.

I don't think there's any particular reason we chose one over the other, but would prefer to not change code and also understand why this is happening. We've noticed it seems to occur with Items that were imported into Sitecore as part of a high-volume bulk load process, but we're not sure if there's a solid connection.

1 Reply
Gravatar for sbelzile@coveo.com

Answer by Sébastien Belzile, Dec 7, 2016 7:56 AM

I'm looking at the code:

The value that Coveo set for _Template is read directly from the SitecoreIndexableItem, which returns the property SitecoreIndexableItem.Item.TemplateID.

The value that Coveo set for the field TemplateId, is read from the same property.

The difference between the two is:

  1. TemplateId is converted by calling TemplateId.Guid.ToString();
  2. _Template is sent to Sitecore's converters defined in the default index configuration, which in Sitecore 8.1 update 3 calls TemplateId.toShortID().toString().toLowerInvariant();.

None of my instances reproduce the issue. Could you tell me:

  1. Which version of Sitecore are you using?
  2. Which version of Coveo are you using? On-premises? Cloud? Build number?
  3. Is there a difference between the serialized version of an item that reproduce the issue and an item that does not?
  4. What happens if you re-index the items reproducing the issue?
Gravatar for loebrandy@gmail.com

Comment by rloeb, Dec 7, 2016 8:45 PM

Answers:

  • Which version of Sitecore are you using?
    • Current Sitecore version: 8.1.160519
  • Which version of Coveo are you using? On-premises? Cloud? Build number?
    • On premises 7.0 x64 Build 8388.0
    • Current Coveo for Sitecore version: 3.0.1312.0
  • Is there a difference between the serialized version of an item that reproduce the issue and an item that does not?
    • Not sure what you mean….before or after we index it?
  • What happens if you re-index the items reproducing the issue?
    • Seems like they're fine and this is what we're using as temporary fix.

Also:

  • _template is marked as external in our index field configuration file
  • templateid is not present in our configuration files and is not external
Gravatar for sbelzile@coveo.com

Comment by Sébastien Belzile, Dec 8, 2016 8:29 AM

Not sure what you mean….before or after we index it?

Serialized version of an item: you said that you import your items into Sitecore. There are many way to achieve this. The OOTB method, using Unicorn, etc.

  1. How do you proceed?

If you use the OOTB method: this means you should have a folder with your items serialized in a file format. I'm asking for the difference between the files you import, and the generated files when you export your items from your Sitecore instance: In the content editor => developer tab => serialize item => generated items are located into the data/serialization folder.

Seems like they're fine and this is what we're using as temporary fix.

  1. How often do you import items like you do?
Ask a question