
META-INF.resources.wiki.search.jsp 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.
*/
--%>
<%@ include file="/wiki/init.jsp" %>
<%
String redirect = ParamUtil.getString(request, "redirect");
WikiNode node = (WikiNode)request.getAttribute(WikiWebKeys.WIKI_NODE);
long nodeId = BeanParamUtil.getLong(node, request, "nodeId");
long[] nodeIds = null;
if (node != null) {
nodeIds = new long[] {nodeId};
}
String keywords = ParamUtil.getString(request, "keywords");
boolean createNewPage = true;
WikiURLHelper wikiURLHelper = new WikiURLHelper(wikiRequestHelper, renderResponse, wikiGroupServiceConfiguration);
PortletURL portletURL = renderResponse.createRenderURL();
portletURL.setParameter("mvcRenderCommandName", "/wiki/search");
portletURL.setParameter("redirect", redirect);
portletURL.setParameter("nodeId", String.valueOf(nodeId));
portletURL.setParameter("keywords", keywords);
%>
<%
Indexer indexer = IndexerRegistryUtil.getIndexer(WikiPage.class);
SearchContext searchContext = SearchContextFactory.getInstance(request);
searchContext.setAttribute("paginationType", "more");
searchContext.setEnd(searchContainer.getEnd());
searchContext.setIncludeAttachments(true);
searchContext.setIncludeDiscussions(true);
searchContext.setKeywords(keywords);
searchContext.setNodeIds(nodeIds);
searchContext.setStart(searchContainer.getStart());
Hits hits = indexer.search(searchContext);
searchContainer.setTotal(hits.getLength());
%>
<%
WikiPage wikiPage = WikiPageLocalServiceUtil.getPage(searchResult.getClassPK());
String title = wikiPage.getTitle();
if (StringUtil.equalsIgnoreCase(title, keywords)) {
createNewPage = false;
}
WikiNode curNode = wikiPage.getNode();
Summary summary = searchResult.getSummary();
%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy