Fórum

Reindex all search indexes programmatically.

thumbnail
Rahul Pande, modificado 11 Anos atrás.

Reindex all search indexes programmatically.

Expert Postagens: 310 Data de Entrada: 07/07/10 Postagens Recentes
Hi All,

Does anyone know how to re-index programmatically in liferay, as we do from control panel ?

Thanks,
Rahul
thumbnail
vipin bardia, modificado 11 Anos atrás.

RE: Reindex all search indexes programmatically.

Regular Member Postagens: 162 Data de Entrada: 28/02/11 Postagens Recentes
Hi Rahul,

You can took a reference from Liferay OOTB portlet.

EditServerAction is the class which contains protected void reindex(ActionRequest actionRequest) method.
This method is used to reindexing, hope it helps....emoticon

Regards,
Vipin Bardia
vkbardia.blogspot.in
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: Reindex all search indexes programmatically.

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Take a look at the following
http://docs.liferay.com/portal/6.1/javadocs/com/liferay/portal/kernel/search/IndexerRegistryUtil.html

Example to reindex user:
Indexer indexer = IndexerRegistryUtil.getIndexer(User.class);
indexer.reindex(userId);
thumbnail
Achmed Tyrannus Albab, modificado 8 Anos atrás.

RE: Reindex all search indexes programmatically.

Regular Member Postagens: 158 Data de Entrada: 05/03/10 Postagens Recentes
Hitoshi Ozawa:
Take a look at the following
http://docs.liferay.com/portal/6.1/javadocs/com/liferay/portal/kernel/search/IndexerRegistryUtil.html

Example to reindex user:
Indexer indexer = IndexerRegistryUtil.getIndexer(User.class);
indexer.reindex(userId);


Any tips on how to reindex search ?
thumbnail
Kailash Yadav, modificado 8 Anos atrás.

RE: Reindex all search indexes programmatically.

Regular Member Postagens: 211 Data de Entrada: 18/10/11 Postagens Recentes
Achmed Tyrannus Albab:
Hitoshi Ozawa:
Take a look at the following
http://docs.liferay.com/portal/6.1/javadocs/com/liferay/portal/kernel/search/IndexerRegistryUtil.html

Example to reindex user:
Indexer indexer = IndexerRegistryUtil.getIndexer(User.class);
indexer.reindex(userId);


Any tips on how to reindex search ?

If you want to reindex all content from code, check following method : https://github.com/liferay/liferay-portal/blob/6.2.x/portal-impl/src/com/liferay/portlet/admin/action/EditServerAction.java#L369

If you want reindex a particular object do like:
Indexer indexer = IndexerRegistryUtil.getIndexer(User.class);
indexer.reindex(userId);