Gravatar for slangevin@coveo.com

Question by Simon, Sep 2, 2016 5:47 AM

Why a return type is necessary.

This question has often been asked. Why are computed fields returned as strings by default if the Return Type property is not in use, as mentioned here: https://developers.coveo.com/display/SitecoreV4/Implementing+and+Configuring+a+Computed+Field+in+Your+Index

Why not use .Net Deserialization which would automatically detect the type serialized object?

My answer is to actually protect the index, since it only supports a certain types of objects, such as mentioned here: https://answers.coveo.com/questions/5342/returning-array-from-a-computed-field

Is this the correct answer?

1 Reply
Gravatar for slangevin@coveo.com

Answer by Simon, Sep 6, 2016 9:42 AM

So the answer is the fact that the return type is used to explicitly set the "Sitecore" type, not the .Net one. So the idea of a .Net serialization/deserialization is not fully relevant. This is simply a Sitecore design choice, and Coveo adapts to it.

Ask a question