Details
-
Bug
-
Status: Closed
-
Resolution: Duplicate
-
6.2.10 EE GA1
-
None
-
2
Description
Reproduction steps:
1. Click on Admin -> Content
2. Create a Structure with a HTML field
3. Create a Template for the Structure (make sure the template has html.getData())
4. Create a Web Content from the structure, for example the following text:
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
5. Add the Search portlet to a page
6. Search for the created Web Content
Experienced behavior: As you can see the whole Web Content is displayed
Expected behavior: The first 200 characters should be displayed, just as in case of basic web contents
The problem is that
protected String getDDMContentSummary( Document document, Locale snippetLocale) { String content = StringPool.BLANK; try { long groupId = GetterUtil.getLong(document.get(Field.GROUP_ID)); String articleId = document.get("articleId"); double version = GetterUtil.getDouble(document.get(Field.VERSION)); JournalArticle article = JournalArticleLocalServiceUtil.fetchArticle( groupId, articleId, version); if (article == null) { return content; } JournalArticleDisplay articleDisplay = JournalArticleLocalServiceUtil.getArticleDisplay( article, null, Constants.VIEW, LocaleUtil.toLanguageId(snippetLocale), 1, null, null); content = HtmlUtil.escape(articleDisplay.getDescription()); content = HtmlUtil.replaceNewLine(content); if (Validator.isNull(content)) { content = HtmlUtil.extractText(articleDisplay.getContent()); } } catch (Exception e) { if (_log.isDebugEnabled()) { _log.debug(e, e); } } return content; }
doesn't set a limit when generating the Summary, while
protected String getBasicContentSummary( Document document, Locale snippetLocale) { String prefix = Field.SNIPPET + StringPool.UNDERLINE; String content = document.get( snippetLocale, prefix + Field.DESCRIPTION, prefix + Field.CONTENT); if (Validator.isBlank(content)) { content = document.get( snippetLocale, Field.DESCRIPTION, Field.CONTENT); } if (content.length() > 200) { content = StringUtil.shorten(content, 200); } return content; }
does.
It's maximum 200 characters of the matching snippet. Not 192.
Verified on
[email protected]
Attachments
Issue Links
- duplicates
-
LPS-25311 Search results - summaries prefer document content over snippets
- Closed