Gravatar for

Question by Cris Corra, Nov 11, 2014 10:52 AM

Can you update the systitle field of a media library item?

Coveo seems to index the title of the actual media data, not the item name, or custom Title field if available. I have a Post Processor set to update the systitle (p_Args.CoveoItem.Title) according to custom fields that are filled out by the user. But the media data's title is still showing as the systitle.

3 Replies
Gravatar for

Answer by Cris Corra, Nov 25, 2014 11:43 AM

I did not find a valid answer nor a way to do this. My solution was to add my own custom Title field and use that for my listings.

Gravatar for

Answer by Vincent Séguin, Nov 11, 2014 6:01 PM

Hi Cris,

Have you tried to only reindex a media item and trace in your postprocessor to make sure it actually sets the Title?

Gravatar for

Comment by Cris Corra, Nov 12, 2014 9:16 AM

Yes, and it seems to have updated the title when I step thru the code, but the update doesn't show when I view the item in the Index Browser, nor when the item is rendered in the results listing.

Gravatar for

Answer by Carl Bolduc, Nov 12, 2014 4:30 PM

Assuming the title you want is in a coveo field, you can use a PostConversion Script to set the title of your document. In the script, you can use the GetFieldValue method to get your title like so (in JavaScript):

var myTitle = DocumentInfo.GetFieldValue("CustomTitleMetadata");

CustomTitleMetadata is the metadata associated to your Coveo field, not the actual field name.

Then, you can set the Title property of the document like so:

DocumentInfo.Title = myTitle;

You can put those method and property calls inside an if that detects if you are currently indexing a media item document.

Gravatar for

Comment by Cris Corra, Nov 14, 2014 11:35 AM

Yes, I am already using a PostCoversion processor (as stated in my initial post). The issue is that when I step thru the code, DocumentInfo.Title is set correctly to my custom title field value (and even stepping thru a second time, the value of DocumentInfo.Title before it being set again, shows it has the correct title stored). But the systitle value that is displayed in the listing is something different…usually the initially set value of whatever the "meta" title tag was. The systitle field is not updating via the DocumentInfo.Title field.

Ask a question