Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Delete personal information in results of SearchResultsPortlet
Hi,
I want to filter the personal information that is shown in each results in SearchResultsPortlet.
By defautl, the portlet shown:
An icon of the user image, type of content, author's name...
I want to hide this information of the results and i don´t see if it's something configurable, like an ADT, preferences, system settings, properties or by other hand is needed to develop a fragment to rewrite this results view.
I attach an image by example
Kind regards
I've seen that all this options are setted in searchResultSummaryDisplayContext.
Is that context configurable by liferay administration?
Hi there. No, you can't really configure a Display Context in Liferay. It's even not extnesible or overridable via a module using supported techniques. I'm going to write a reply in a few minutes that I hope can guide you to a couple possible solutions.
If you are on 7.3 you can do what you want with a Widget Template. I was able to remove the User Portrait very easily just now, by
1. Copy the existing "List Template" src code. GiHub src
2. Add a new Widget Template targeted at the Search Results widget, and copy in the src from the original
3. Remove this block near the beginning of the template
<div class="autofit-col">
<#if entry.isUserPortraitVisible()>
<@liferay_ui["user-portrait"] userId=entry.getAssetEntryUserId() />
</#if>
<#if entry.isThumbnailVisible()>
<img alt="${languageUtil.get(locale, "thumbnail")}" class="rounded search-result-thumbnail-img" src="${entry.getThumbnailURLString()}" />
</#if>
<#if entry.isIconVisible()>
<span class="search-asset-type-sticker sticker sticker-rounded sticker-secondary sticker-static">
<@clay.icon symbol="${entry.getIconId()}" />
</span>
</#if>
</div>
4. Go to the Search Results widget configuration and change the Display Template to use your customized template.
If you're on an earlier version, the only way I know of getting at the result summaries are by overriding the summary building logic via IndexerPostProcessor or ModelSuymmaryContributor, depending on whether the model uses the old inheritance-based indexer architecture or the newer composite indexer
Powered by Liferay™