
META-INF.resources.blogs_admin.entry_search_results.jspf Maven / Gradle / Ivy
<%--
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%
if ((assetCategoryId != 0) || Validator.isNotNull(assetTagName)) {
SearchContainerResults searchContainerResults = BlogsUtil.getSearchContainerResults(searchContainer);
searchContainer.setTotal(searchContainerResults.getTotal());
List assetEntries = searchContainerResults.getResults();
for (AssetEntry assetEntry : assetEntries) {
results.add(BlogsEntryLocalServiceUtil.getBlogsEntry(assetEntry.getClassPK()));
}
}
else if (Validator.isNull(keywords)) {
if (entriesNavigation.equals("mine")) {
total = BlogsEntryServiceUtil.getGroupUserEntriesCount(scopeGroupId, themeDisplay.getUserId(), WorkflowConstants.STATUS_ANY);
}
else {
total = BlogsEntryServiceUtil.getGroupEntriesCount(scopeGroupId, WorkflowConstants.STATUS_ANY);
}
searchContainer.setTotal(total);
if (entriesNavigation.equals("mine")) {
results = BlogsEntryServiceUtil.getGroupUserEntries(scopeGroupId, themeDisplay.getUserId(), WorkflowConstants.STATUS_ANY, searchContainer.getStart(), searchContainer.getEnd(), searchContainer.getOrderByComparator());
}
else {
results = BlogsEntryServiceUtil.getGroupEntries(scopeGroupId, WorkflowConstants.STATUS_ANY, searchContainer.getStart(), searchContainer.getEnd(), searchContainer.getOrderByComparator());
}
}
else {
Indexer indexer = IndexerRegistryUtil.getIndexer(BlogsEntry.class);
SearchContext searchContext = SearchContextFactory.getInstance(request);
searchContext.setEnd(searchContainer.getEnd());
searchContext.setKeywords(keywords);
searchContext.setStart(searchContainer.getStart());
Hits hits = indexer.search(searchContext);
searchContainer.setTotal(hits.getLength());
for (int i = 0; i < hits.getDocs().length; i++) {
Document doc = hits.doc(i);
long entryId = GetterUtil.getLong(doc.get(Field.ENTRY_CLASS_PK));
BlogsEntry entry = null;
try {
entry = BlogsEntryServiceUtil.getEntry(entryId);
entry = entry.toEscapedModel();
}
catch (Exception e) {
if (_log.isWarnEnabled()) {
_log.warn("Blogs search index is stale and contains entry " + entryId);
}
continue;
}
results.add(entry);
}
}
searchContainer.setResults(results);
%>
<%!
private static Log _log = LogFactoryUtil.getLog("com_liferay_blogs_web.blogs_admin.entry_search_results_jspf");
%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy