Customize BlogsEntry problems - Indexing and search

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值