Forums de discussion

Overwriting the Indexer classes of the portlets

Sri Sri, modifié il y a 10 années.

Overwriting the Indexer classes of the portlets

New Member Publications: 4 Date d'inscription: 30/04/13 Publications récentes
I've a requirement where in I'd like to override some of the indexing methods of the custom Indexer classes of all/some of the portlets (like MBIndexer.java, WikiIndexer.java, etc).

With this being a part of portal-impl.jar (classes) I'm aware I need to override using an ext-plugin (which is what I did along with overriding the portlet namespaces in the liferay-portlet-ext.xml). For eg. in the wiki portlet config, changed the <indexer-class> tag to use my CustomWikiInder class.

<portlet>
<portlet-name>36</portlet-name>
<icon>/html/icons/wiki.png</icon>
<struts-path>wiki</struts-path>
<configuration-action-class>com.liferay.portlet.wiki.action.ConfigurationActionImpl</configuration-action-class>

<indexer-class>com.hca.pulse.common.impl.CustomWikiIndexer</indexer-class>

<open-search-class>com.liferay.portlet.wiki.util.WikiOpenSearchImpl</open-search-class>
<friendly-url-mapper-class>com.liferay.portlet.wiki.WikiFriendlyURLMapper</friendly-url-mapper-class>
<friendly-url-mapping>wiki</friendly-url-mapping>
<friendly-url-routes>com/liferay/portlet/wiki/wiki-friendly-url-routes.xml</friendly-url-routes>
<portlet-data-handler-class>com.liferay.portlet.wiki.lar.WikiPortletDataHandlerImpl</portlet-data-handler-class>
<social-activity-interpreter-class>com.liferay.portlet.wiki.social.WikiActivityInterpreter</social-activity-interpreter-class>
<asset-renderer-factory>com.liferay.portlet.wiki.asset.WikiPageAssetRendererFactory</asset-renderer-factory>
<custom-attributes-display>com.liferay.portlet.wiki.WikiPageCustomAttributesDisplay</custom-attributes-display>
<permission-propagator>com.liferay.portlet.wiki.security.permission.WikiPermissionPropagatorImpl</permission-propagator>
<workflow-handler>com.liferay.portlet.wiki.workflow.WikiPageWorkflowHandler</workflow-handler>
<preferences-owned-by-group>true</preferences-owned-by-group>
<use-default-template>false</use-default-template>
<scopeable>true</scopeable>
<private-request-attributes>false</private-request-attributes>
<private-session-attributes>false</private-session-attributes>
<render-weight>50</render-weight>
<header-portlet-css>/html/portlet/wiki/css/main.css</header-portlet-css>
<footer-portal-javascript>/html/js/liferay/service.js</footer-portal-javascript>
<css-class-wrapper>portlet-wiki</css-class-wrapper>
<add-default-resource>true</add-default-resource>
</portlet>

I would like to know if there is a better way to go about this or, precisely, if the exact same class or any other wrapper class which I'm not aware of can be overriden using a portlet/hook?
thumbnail
Amos Fong, modifié il y a 10 années.

RE: Overwriting the Indexer classes of the portlets

Liferay Legend Publications: 2047 Date d'inscription: 07/10/08 Publications récentes
I think you might be able to do this just calling IndexerRegistryUtil in a hook or plugin.
thumbnail
Kan Zhang, modifié il y a 10 années.

RE: Overwriting the Indexer classes of the portlets

Junior Member Publications: 68 Date d'inscription: 01/12/10 Publications récentes
You might want to try Indexer post processor in Liferay hook plugin

Read the source code of com.liferay.portal.kernel.search.BaseIndexerPostProcessor to find what the Indexer post processor can do.