News search results
搜索栏
搜索结果
处理模板时发生错误。
The string doesn't match the expected date/time/date-time format. The string to parse was: "2026-2-26 下午12:10". The expected format was: "dd/MM/yyyy hh:mm a".
The nested reason given follows:
Unparseable date: "2026-2-26 下午12:10"
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${entry.getCreationDateString()?datet... [in template "20099#20135#93644519" at line 176, column 49]
---- 1<#-- DDM Template Key: "NEWS-SEARCH-RESULTS-LIST-FTL" --> 2<#assign JOURNAL_ARTICLE_CLASS_NAME = "com.liferay.journal.model.JournalArticle" /> 3<#-- assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") /> 4<#assign article = journalArticleLocalService.fetchLatestArticle(entry.getClassPK()) /--> 5 6<#-- ${journalArticleLocalService} --> 7<#-- ${article} --> 8 9 10 11<#-- ----------------------------------------------------------------------- --> 12<#-- Init Logger --> 13<#-- ----------------------------------------------------------------------- --> 14 15<#assign log = objectUtil("com.liferay.portal.kernel.log.LogFactoryUtil").getLog("webcms.portal.template.widget.news-search-result-list") /> 16 17 18<#-- Categories --> 19<#assign journalArticleResourceLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleResourceLocalService") /> 20<#assign assetCategoryLocalServiceUtil = staticUtil["com.liferay.asset.kernel.service.AssetCategoryLocalServiceUtil"] /> 21<#assign assetVocabularyLocalServiceUtil = staticUtil["com.liferay.asset.kernel.service.AssetVocabularyLocalServiceUtil"] /> 22 23<#assign searchResults = [] /> 24<#if searchContainer?has_content> 25 <#assign searchResults = searchContainer.getResults()![] /> 26 <#if searchResults?has_content> 27 </#if> 28</#if> 29 30<#assign searchResultsDocuments = [] /> 31<#if searchResultsPortletDisplayContext?has_content> 32 <#assign searchResultsDocuments = searchResultsPortletDisplayContext.getDocuments()![] /> 33 <#if searchResultsDocuments?has_content> 34 <!-- searchResultsDocuments.size : ${searchResultsDocuments?size} --> 35 </#if> 36</#if> 37 38<#assign newsCategoryNames = [] /> 39<#assign newsVocabName = "news categories" /> 40<#assign newsVocabId = -1 /> 41<#assign newsVocab = "" /> 42<#assign newsCategories = [] /> 43<#assign categories = [] /> 44 45<#-- Vars --> 46<#attempt> 47 <#assign newsVocabId = findAssetVocabularyIdByName(newsVocabName, -1) /> 48 <#assign newsVocab = assetVocabularyLocalServiceUtil.getAssetVocabulary(newsVocabId) /> 49 50 <#if newsVocab?has_content> 51 <#assign newsCategories = newsVocab.getCategories() /> 52 </#if> 53 54 <#if newsCategories?has_content> 55 <#if newsCategories?size gt 0> 56 <#list newsCategories as newsCategory> 57 <#assign newsCategoryNames = newsCategoryNames + [newsCategory.name] /> 58 </#list> 59 </#if> 60 </#if> 61<#recover> 62</#attempt> 63 64 65<div id="searchFilterContainer"> 66 <#-- dynamic placement of search filters on mobile --> 67</div> 68 69<p class="search-total-label text-default"> 70 We found <strong>${searchContainer.getTotal()}</strong> 71<#if searchResultsPortletDisplayContext.getKeywords()?trim?length > 0> 72 results for <strong>${htmlUtil.escape(searchResultsPortletDisplayContext.getKeywords())}</strong>. 73<#else> 74 results. 75</#if> 76</p> 77 78<#-- ---------------------------------- --> 79<#-- Render search results news --> 80<#-- ---------------------------------- --> 81 82<div class="display-list lfr-search-container-wrapper"> 83 <#if entries?has_content> 84 <#list entries as entry> 85 <#-- if entry?has_content--> 86 87 <#-- DOE CHANGE START --> 88 <#if entry?has_content> 89 ${log.info("entry index : " + entry?index)} 90 ${log.info("entry.title : " + (entry.getTitle())!"")} 91 ${log.info("entry.iconId : " + (entry.getIconId())!"")} 92 ${log.info("entry.className : " + (entry.getClassName())!"")} 93 ${log.info("entry.classPK : " + (entry.getClassPK())!"")} 94 ${log.info("entry.resourceImage : " + (entry.getResourceImage())!"")} 95 </#if> 96 97 <#assign searchDocument = "" /> 98 <#if entry?has_content> 99 <#if searchResults?has_content> 100 <#assign entryIndex = entry?index /> 101 <#assign searchDocument = searchResults[entryIndex] /> 102 <#-- searchDocument ${entryIndex} : ${searchDocument} : entry- ${entry} --> 103 </#if> 104 </#if> 105 106 <#assign categories = getSearchDocumentFieldValue(searchDocument, "assetCategoryTitles", "") /> 107 <#assign articleId = getSearchDocumentFieldValue(searchDocument, "articleId", "") /> 108 <#assign resourceImage = getSearchDocumentFieldValue(searchDocument, "ddm__.*resourceImage.*", "") /> 109 <#assign dateCreated = getSearchDocumentFieldValue(searchDocument, "ceateDate","") /> 110 111 112 113 <#if articleId?has_content> 114 ${log.info("articleId : " + articleId)} 115 116 <#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService" ) /> 117 118 ${log.info("journalArticleLocalService : " + journalArticleLocalService)} 119 <#assign articleResourcePK = journalArticleResourceLocalService.getArticleResourcePrimKey(groupId,articleId) /> 120 121 <#assign categoryList = assetCategoryLocalServiceUtil.getCategories("com.liferay.journal.model.JournalArticle",articleResourcePK) /> 122 123 <#-- <#assign article = journalArticleLocalService.getArticle(getterUtil.getLong(groupId), articleId) /> --> 124 </#if> 125 126 <div class="card mb-4 pb-3 w-100 border-top-0 border-left-0 border-right-0 border-bottom rounded-0"> 127 <div class="row no-gutters m-0"> 128 <#if resourceImage?has_content> 129 <#assign removePadding = "px-sm-3" /> 130 <#assign removePaddingTitle = "pl-sm-3" /> 131 <div class="col-12 col-sm-3 col-lg-2 p-0"> 132 <#-- ${log.info("resourceImage : " + resourceImage)} --> 133 <#assign imageParams = "f_auto" /> 134 <#assign imagePath = resourceImage /> 135 <#assign imageSrc = buildCloudinaryImageUrl(imageParams, imagePath) /> 136 <#-- ${log.debug("imageSrc : " + imageSrc)} --> 137 <#assign escapedImageSrc = htmlUtil.escapeHREF(imageSrc) /> 138 <#-- ${log.debug("escapedImageSrc : " + escapedImageSrc)} --> 139 <img class="news-search__image img-fluid" alt="" src="${escapedImageSrc}" /> 140 </div> 141 142 <div class="col-12 col-sm-9 col-lg-10 p-0"> 143 <#else> 144 <#assign removePadding = "" /> 145 <#assign removePaddingTitle = "" /> 146 <div class="col-12 p-0"> 147 </#if> 148 149 <div class="card-body ${removePaddingTitle} pt-sm-0 pt-2 p-0 d-flex flex-column flex-sm-row justify-content-sm-between align-items-start"> 150 <h5 class="card-title mt-2 mt-sm-0 mb-0 order-2 order-sm-1"> 151 <a href="${entry.getViewURL()}"> 152 ${entry.getHighlightedTitle()} 153 </a> 154 </h5> 155 <#-- Loop through all categories assigned to the news article --> 156 <div class="categories order-1 order-sm-2 text-sm-right flex-shrink-sm-0 ml-sm-4 ml-0"> 157 <#if categoryList?? && categoryList?has_content> 158 <#list categoryList as categoryListing> 159 <#assign vocabularyId = categoryListing.getVocabularyId() /> 160 <#-- Set the ID for the News section vocabulary --> 161 <#-- if vocabularyId == 379886 --> 162 <span class="mb-0 news__category ${categoryListing.getName()?replace(' ','-')?lower_case} news__category-${newsCategoryNames?seq_index_of(categoryListing.getName())}">${categoryListing.getName()}</span> 163 </#list> 164 </#if> 165 </div> 166 </div> 167 168 <div class="card-body ${removePadding} py-0 px-0 "> 169 <#if entry.isCreationDateVisible() && entry.getCreationDateString()?has_content> 170 171 172 <p class="card-text mb-1"> 173 <small class="font-weight-bold"> 174 <#setting date_format="dd MMMM yyyy"> 175 <#setting locale="en_AU"> 176 ${entry.getCreationDateString()?datetime("dd/MM/yyyy hh:mm a")?date}</small> 177 </p> 178 </#if> 179 <#if entry.getContent()?? && entry.getContent()?has_content> 180 <p class="card-text">${entry.getContent()}</p> 181 </#if> 182 </div> 183 184 </div> 185 </div> 186 </div> 187 </#list> 188 </#if> 189 190</div> 191 192<#-- ----------------------------------------------------------------------- --> 193<#-- Functions --> 194<#-- ----------------------------------------------------------------------- --> 195 196<#-- 197-- Returns the first value matching the search results docment field name by regex, otherwise the defaultValue is returned. 198-- 199-- The search document must be of type "com.liferay.portal.kernel.search.Document" 200-- 201-- @see com.liferay.portal.kernel.search.Document 202--> 203<#function getSearchDocumentFieldValue searchDocument regex defaultValue> 204 ${log.info("getSearchDocumentFieldValue ...")} 205 ${log.info("searchDocument : " + searchDocument)} 206 ${log.info("regex : " + regex)} 207 ${log.info("defaultValue : " + defaultValue)} 208 209 <#assign fieldValueResult = defaultValue /> 210 <#attempt> 211 <#if searchDocument?has_content && regex?has_content> 212 <#assign searchDocumentFields = searchDocument.getFields() /> 213 <#if searchDocumentFields?has_content> 214 <#list searchDocumentFields as fieldKey, fieldValue> 215 <#if fieldKey?has_content> 216 <#assign fieldName = fieldKey /> 217 <#if fieldName?matches(regex)> 218 <#assign fieldValueResult = (searchDocument.get(fieldKey))!defaultValue /> 219 <#break> 220 </#if> 221 </#if> 222 </#list> 223 </#if> 224 </#if> 225 <#recover> 226 <#-- NO-OP --> 227 </#attempt> 228 229 ${log.info("getSearchDocumentFieldValue : " + fieldValueResult)} 230 <#return fieldValueResult> 231</#function> 232 233<#function findAssetVocabularyIdByName vocabName defaultVocabId> 234 <#assign assetVocabularyId = defaultVocabId /> 235 236 <#attempt> 237 <#assign assetVocabList = assetVocabularyLocalServiceUtil.getAssetVocabularies(0, staticFieldGetter.getFieldValue("java.lang.Integer", "MAX_VALUE")) /> 238 <#if assetVocabList?has_content> 239 <#list assetVocabList as assetVocabItem> 240 <#assign assetVocabItemName = assetVocabItem.getName() /> 241 <#if assetVocabItemName?lower_case == vocabName?lower_case > 242 <#assign assetVocabularyId = assetVocabItem.getVocabularyId() /> 243 </#if> 244 </#list> 245 </#if> 246 <#recover> 247 <#assign assetVocabularyId = defaultVocabId /> 248 </#attempt> 249 250 <#return assetVocabularyId> 251</#function> 252 253<#function buildCloudinaryImageUrl imageParams imagePath> 254 <#assign cloudinaryImageUrl = "" /> 255 <#attempt> 256 <#if imageParams?has_content && imagePath?has_content> 257 <#assign cloudinaryBaseUrl = webcms.getCloudinaryPath() /> 258 <#if !cloudinaryBaseUrl?ends_with("/")> 259 <#assign cloudinaryBaseUrl = cloudinaryBaseUrl + "/" /> 260 </#if> 261 <#if !imagePath?starts_with("/")> 262 <#assign imagePath = "/" + imagePath /> 263 </#if> 264 <#assign cloudinaryImageUrl = cloudinaryBaseUrl + imageParams + imagePath /> 265 </#if> 266 <#recover> 267 <#-- NO-OP --> 268 </#attempt> 269 270 <#return cloudinaryImageUrl> 271</#function>