Change Liferay Search Indexer

社会主义新天地 提交于 2019-12-11 17:48:56

问题


I want to override the functionality of an indexer and what I found was that the indexer is defined in the liferay-portlet.xml and so I cannot override the indexer unless I changed the file on the server which is a bad practice, so is there anyway I can change the indexer in a good manner ??


回答1:


If you are using 6.0 or higher, you can change the way a document is indexed by using a hook plugin.

Simply define in your liferay-hook.xml

<indexer-post-processor>
    <indexer-class-name>com.liferay.portal.model.User</indexer-class-name>
    <indexer-post-processor-impl>com.example.hook.indexer.UserIndexerPostProcessor</indexer-post-processor-impl>
</indexer-post-processor>

In your post processor class extend com.liferay.portal.kernel.search.BaseIndexerPostProcessor and implement the method you need to change up.



来源:https://stackoverflow.com/questions/8231851/change-liferay-search-indexer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!