I am using Solr for internal Search and also for filtering content items in my Sitefinity MVC. I am creating a View for a list of events, the View will be used to render the Search results of my Solr widget.
My Event content type has a field for "Summary", which is a Long text (text area) type. More about filed types in Sitefinity can be found here: https://www.progress.com/documentation/sitefinity-cms/use-custom-fields-in-widget-templates-dp
For some reason, I can pull any other field values and display them in my View, except for the "Summary" field.
For Short text fields I used @item.getStringField("State")
and it works fine.
For my Long text (editor) fields, which are HTML content, I used @Html.Raw(item.getHtmlField("Agenda"))
and they also work fine, so I thought I can do the same with "Summary" field but this @Html.Raw(item.getHtmlField("Summary"))
does not return any value.
How does Solr see Long text (text area) different than Long text (editor) or Short text? Do I need a different method other than getHtmlField()
for Long text (text area) fields?
In Sitefinity MVC views you can access the fields through item.Fields.FieldName. And in details view you use Model.Item.Fields.FieldName
Here is an example for the Summary field in the listing view:
@Html.HtmlSanitize((string)item.Fields.Summary)
In the details view you can get the Summary using the below:
@Html.HtmlSanitize((string)Model.Item.Fields.Summary)
You will need to add the below using statement:
@using Telerik.Sitefinity.Frontend.Mvc.Helpers