Skip to content

Instantly share code, notes, and snippets.

@nshaw
Created April 19, 2013 15:43
Show Gist options
  • Save nshaw/5421190 to your computer and use it in GitHub Desktop.
Save nshaw/5421190 to your computer and use it in GitHub Desktop.
List the indexers defined for the Document Library Portlet
import com.liferay.portal.kernel.search.Indexer
import com.liferay.portal.kernel.search.IndexerPostProcessor
import com.liferay.portal.model.Portlet
import com.liferay.portal.service.CompanyLocalServiceUtil
import com.liferay.portal.service.PortletLocalServiceUtil
try {
String portletId = "20"; //Document Library
long companyId = CompanyLocalServiceUtil.getCompanies().get(0).getCompanyId();
Portlet portlet = PortletLocalServiceUtil.getPortletById(
companyId, portletId);
println "Portlet: " + portlet
List<Indexer> indexers = portlet.getIndexerInstances();
for (Indexer indexer : indexers) {
println "Indexer: engineId:" + indexer.searchEngineId + ", " + indexer
IndexerPostProcessor[] processors = indexer.getIndexerPostProcessors()
for (IndexerPostProcessor processor : processors) {
println "Post processor: " + processor
}
}
}
catch (Exception e) {
println "Script failed " + e
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment