掲示板

Reindex all search indexes programmatically.

thumbnail
11年前 に Rahul Pande によって更新されました。

Reindex all search indexes programmatically.

Expert 投稿: 310 参加年月日: 10/07/07 最新の投稿
Hi All,

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

Thanks,
Rahul
thumbnail
11年前 に vipin bardia によって更新されました。

RE: Reindex all search indexes programmatically.

Regular Member 投稿: 162 参加年月日: 11/02/28 最新の投稿
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
11年前 に Hitoshi Ozawa によって更新されました。

RE: Reindex all search indexes programmatically.

Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿
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
8年前 に Achmed Tyrannus Albab によって更新されました。

RE: Reindex all search indexes programmatically.

Regular Member 投稿: 158 参加年月日: 10/03/05 最新の投稿
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
8年前 に Kailash Yadav によって更新されました。

RE: Reindex all search indexes programmatically.

Regular Member 投稿: 211 参加年月日: 11/10/18 最新の投稿
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);