This content has been marked as final.
Show 2 replies
-
1. Re: Search Portlet?
albertodominguezs Jul 28, 2009 4:12 PM (in response to tomhombergs)Hi Tom,
I didn't get any help or info. However, while I was debugging a custom LoginModule I found some really useful lines inside the org.jboss.portal.core.cms.ui.admin.CMSAdminPortlet.java.
Hope these lines work for you.package org.jboss.portal.core.cms.ui.admin; // ... public class CMSAdminPortlet extends JBossPortlet { // ... private void internalDoView(JBossRenderRequest rReq, JBossRenderResponse rRes) throws CMSException, PortletException, IOException { // ... else if (CMSAdminConstants.OP_VIEWSEARCHRESULTS.equals(op)) { rRes.setContentType("text/html"); String textQuery = rReq.getParameter("search"); FederatedQuery query = new FederatedQuery(textQuery); JCRQueryConverter converter = new JCRQueryConverter(); List files; try { Command searchCommand = CMSService.getCommandFactory().createSearchCommand((JCRQuery)converter.convert(query)); files = (List)CMSService.execute(searchCommand); } catch (CMSException e) { e.printStackTrace(); files = new ArrayList(); } catch (QueryConversionException e) { files = new ArrayList(); rReq.setAttribute("conversionError", Boolean.TRUE); } rReq.setAttribute("files", files); rReq.setAttribute("textQuery", textQuery); javax.portlet.PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH + "/searchResults.jsp"); prd.include(rReq, rRes); }
-
2. Re: Search Portlet?
tomhombergs Aug 13, 2009 7:11 AM (in response to tomhombergs)Hi Alberto,
thanks for the reply. I guess the code you posted only searches the jboss-cms content, though.
However, I now built a custom solution using Apache Lucene as search engine. Sadly, it's not a generic solution but rather specific for our purposes.