Forums de discussion

Reindex all search indexes programmatically.

thumbnail
Rahul Pande, modifié il y a 11 années.

Reindex all search indexes programmatically.

Expert Publications: 310 Date d'inscription: 07/07/10 Publications récentes
Hi All,

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

Thanks,
Rahul
thumbnail
vipin bardia, modifié il y a 11 années.

RE: Reindex all search indexes programmatically.

Regular Member Publications: 162 Date d'inscription: 28/02/11 Publications récentes
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, modifié il y a 11 années.

RE: Reindex all search indexes programmatically.

Liferay Legend Publications: 7942 Date d'inscription: 24/03/10 Publications récentes
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, modifié il y a 8 années.

RE: Reindex all search indexes programmatically.

Regular Member Publications: 158 Date d'inscription: 05/03/10 Publications récentes
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, modifié il y a 8 années.

RE: Reindex all search indexes programmatically.

Regular Member Publications: 211 Date d'inscription: 18/10/11 Publications récentes
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);