问题
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