Created
June 22, 2017 16:31
-
-
Save anonymous/c3f98deedbae285e293b2fdddb28909e to your computer and use it in GitHub Desktop.
Groovy Liferay re-index specific User
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.liferay.portal.kernel.search.IndexerRegistryUtil; | |
import com.liferay.portal.kernel.search.Indexer | |
import com.liferay.portal.model.User | |
import com.liferay.portal.util.*; | |
import com.liferay.portal.service.* | |
import com.liferay.portal.service.ServiceContext; | |
try { | |
long companyId = PortalUtil.getDefaultCompanyId(); | |
User user = UserLocalServiceUtil.getUserByScreenName(companyId, "sasupport" ); | |
out.println("User:"+user); | |
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(User.class); | |
indexer.reindex(user); | |
out.println("User reindexed"); | |
}catch (e) { | |
out.println("Error = " + e.getMessage()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment