When I customize BlogsEntry by using Ext Plugin. When I add a blog, I don't need to reindex in Liferay 6.0. It automatically does that for us and we can search it successfully. But when it comes to Liferay 6.1, so we need to do reindex when we add or update BlogsEntry.
Here is my codes:
public class BlogsEntryServiceImpl extends BlogsEntryServiceBaseImpl {
@Override
public BlogsEntry addEntry(String title, String description, String content,
int displayDateMonth, int displayDateDay, int displayDateYear, int displayDateHour,
int displayDateMinute, boolean allowPingbacks, boolean allowTrackbacks,
String[] trackbacks, boolean smallImage, String smallImageURL,
String smallImageFileName, InputStream smallImageInputStream,
ServiceContext serviceContext) throws PortalException, SystemException {
BlogsPermission.check(getPermissionChecker(), serviceContext.getScopeGroupId(),
ActionKeys.ADD_ENTRY);
BlogsEntry entry = BlogsEntryLocalServiceUtil.addEntry(getUserId(), title,
description, content, displayDateMonth, displayDateDay, displayDateYear,
displayDateHour, displayDateMinute, allowPingbacks, allowTrackbacks, trackbacks,
smallImage, smallImageURL, smallImageFileName, smallImageInputStream,
serviceContext);
Indexer indexer = IndexerRegistryUtil.getIndexer(BlogsEntry.class);
indexer.reindex(entry);
return entry;
}
@Override
public BlogsEntry updateEntry(long entryId, String title, String description, String content,
int displayDateMonth, int displayDateDay, int displayDateYear, int displayDateHour,
int displayDateMinute, boolean allowPingbacks, boolean allowTrackbacks,
String[] trackbacks, boolean smallImage, String smallImageURL,
String smallImageFileName, InputStream smallImageInputStream,
ServiceContext serviceContext) throws PortalException, SystemException {
BlogsEntryPermission.check(getPermissionChecker(), entryId, ActionKeys.UPDATE);
BlogsEntry blogsEntry = blogsEntryLocalService.updateEntry(getUserId(), entryId, title,
description, content, displayDateMonth, displayDateDay, displayDateYear,
displayDateHour, displayDateMinute, allowPingbacks, allowTrackbacks, trackbacks,
smallImage, smallImageURL, smallImageFileName, smallImageInputStream,
serviceContext);
Indexer indexer = IndexerRegistryUtil.getIndexer(BlogsEntry.class);
indexer.reindex(blogsEntry);
return blogsEntry;
}
.....
Make sure we don't need to delete index when we deleteEntry, Liferay takes care of that.