Coveo not returning crawled records where column fields are blank

We are trying to use a conditional statement that would either return the value of a field in a record from a crawled sharepoint list. however it appears we are unable to do properly because the coveo field is not pulled in when the value of a column is blank in sharepoint. We are trying to display social media links that are in stored in sharepoint, yet when there is no link in a particular field, we wish to remove the entire <div> so the other icons that do have links can shift down. it would seem in our statement below, because the field is blank, the column name is not understood, therefore the if statement fails. Any ideas?

1 Reply

When a field has no value in the original document, it is not indexed and not returned by the Coveo Search API. You can test for the presence of a field in the raw object like this: if (raw.fblink). If fblink exists (have a value), the condition will be true. If fblink does not exist, it will be undefined and the condition will be false.