use of com.liferay.portal.kernel.search.Document in project liferay-ide by liferay.
the class SongIndexer method doGetDocument.
@Override
protected Document doGetDocument(Object obj) throws Exception {
Song song = (Song) obj;
Document document = getBaseModelDocument(PORTLET_ID, song);
document.addDate(Field.MODIFIED_DATE, song.getModifiedDate());
document.addText(Field.TITLE, song.getName());
Album album = AlbumLocalServiceUtil.getAlbum(song.getAlbumId());
document.addText("album", album.getName());
document.addKeyword("albumId", album.getAlbumId());
Artist artist = ArtistLocalServiceUtil.getArtist(song.getArtistId());
document.addText("artist", artist.getName());
document.addKeyword("artistId", artist.getArtistId());
return document;
}
use of com.liferay.portal.kernel.search.Document in project liferay-ide by liferay.
the class AdminIndexer method doGetDocument.
@Override
protected Document doGetDocument(Object obj) throws Exception {
KBArticle kbArticle = (KBArticle) obj;
Document document = getBaseModelDocument(PORTLET_ID, kbArticle);
document.addText(Field.CONTENT, HtmlUtil.extractText(kbArticle.getContent()));
document.addText(Field.DESCRIPTION, kbArticle.getDescription());
document.addText(Field.TITLE, kbArticle.getTitle());
document.addKeyword("titleKeyword", kbArticle.getTitle(), true);
return document;
}
use of com.liferay.portal.kernel.search.Document in project liferay-ide by liferay.
the class AdminIndexer method reindexKBArticles.
protected void reindexKBArticles(KBArticle kbArticle) throws Exception {
// See KBArticlePermission#contains
List<KBArticle> kbArticles = KBArticleLocalServiceUtil.getKBArticleAndAllDescendantKBArticles(kbArticle.getResourcePrimKey(), WorkflowConstants.STATUS_APPROVED, null);
Collection<Document> documents = new ArrayList<Document>();
for (KBArticle curKBArticle : kbArticles) {
documents.add(getDocument(curKBArticle));
}
SearchEngineUtil.updateDocuments(getSearchEngineId(), kbArticle.getCompanyId(), documents);
}
use of com.liferay.portal.kernel.search.Document in project liferay-ide by liferay.
the class AdminIndexer method reindexKBArticles.
protected void reindexKBArticles(long companyId) throws Exception {
ActionableDynamicQuery actionableDynamicQuery = new KBArticleActionableDynamicQuery() {
@Override
protected void addCriteria(DynamicQuery dynamicQuery) {
Property property = PropertyFactoryUtil.forName("status");
dynamicQuery.add(property.eq(WorkflowConstants.STATUS_APPROVED));
}
@Override
protected void performAction(Object object) throws PortalException {
KBArticle kbArticle = (KBArticle) object;
Document document = getDocument(kbArticle);
addDocument(document);
}
};
actionableDynamicQuery.setCompanyId(companyId);
actionableDynamicQuery.setSearchEngineId(getSearchEngineId());
actionableDynamicQuery.performActions();
}
use of com.liferay.portal.kernel.search.Document in project liferay-ide by liferay.
the class AlbumIndexer method reindexEntries.
protected void reindexEntries(long companyId) throws PortalException {
final Collection<Document> documents = new ArrayList<Document>();
ActionableDynamicQuery actionableDynamicQuery = AlbumLocalServiceUtil.getActionableDynamicQuery();
actionableDynamicQuery.setCompanyId(companyId);
actionableDynamicQuery.performActions();
SearchEngineUtil.updateDocuments(getSearchEngineId(), companyId, documents);
}
Aggregations