Message Boards

Delete personal information in results of SearchResultsPortlet

Iñigo Boyano, modified 3 Years ago.

Delete personal information in results of SearchResultsPortlet

Junior Member Posts: 96 Join Date: 2/4/14 Recent Posts

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ñigo Boyano, modified 3 Years ago.

RE: Delete personal information in results of SearchResultsPortlet

Junior Member Posts: 96 Join Date: 2/4/14 Recent Posts

I've seen that all this options are setted in searchResultSummaryDisplayContext.

Is that context configurable by liferay administration?

thumbnail
Russell Bohl, modified 3 Years ago.

RE: RE: Delete personal information in results of SearchResultsPortlet

Expert Posts: 291 Join Date: 2/13/13 Recent Posts

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.

thumbnail
Russell Bohl, modified 3 Years ago.

RE: Delete personal information in results of SearchResultsPortlet

Expert Posts: 291 Join Date: 2/13/13 Recent Posts

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