Message Boards

Liferay 7 Search Portlet - Only show journal articles and PDF files as sea

srini vasulu, modified 4 Years ago.

Liferay 7 Search Portlet - Only show journal articles and PDF files as sea

Regular Member Posts: 139 Join Date: 2/22/11 Recent Posts
Hi,1) In liferay 7 search portlet we need to customize to sort the results like title name ect.
2) We need to add the more input fields fileTypess(like adding file tyle .pdf,.docx) and only get file same file types and did not search any other places.in 6.2 start.jsp file added like below files.<aui:input inlineField="<%= true %>" label="File Type (pdf, docx, etc)" name='<%= namespace + "fileExtension" %>' size="30" title="extension" type="text" useNamespace="<%= false %>"/> 
and got the value in search.jsp and that value passed in main-search.jsp fileif(Validator.isNotNull(fileExtension) && fileExtension != ""){
    Query fileExtensionQuery = StringQueryFactoryUtil.create("entryClassName:com.liferay.portlet.documentlibrary.model.DLFileEntry +extension:"+fileExtension);
    BooleanClause fileExtensionClause = BooleanClauseFactoryUtil.create(searchContext, fileExtensionQuery, BooleanClauseOccur.MUST.getName());
    booleanClauseList.add(fileExtensionClause);}
 if(booleanClauseList.size()>0){
        BooleanClause[] booleanClause = new BooleanClause[booleanClauseList.size()];
        booleanClause = booleanClauseList.toArray(booleanClause);
        searchContext.setBooleanClauses(booleanClause);
    //searchContext.setBooleanClauses(new BooleanClause[] {fileExtensionClause,pbDocumentTypeClause});
    } 
and we got only file extension but in liferay 7 how we will implement same functionality?
we need to implement it only custom portlet and using hook we can implement? if we are able to implement using hook the what steps we need to take care?. 
srini vasulu, modified 4 Years ago.

RE: Liferay 7 Search Portlet - Only show journal articles and PDF files as

Regular Member Posts: 139 Join Date: 2/22/11 Recent Posts
Hi Any suggestions on this? 
thumbnail
Andrew Jardine, modified 4 Years ago.

RE: Liferay 7 Search Portlet - Only show journal articles and PDF files as

Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Hi Srini,It's not pretty, but you are on the right track. If you re using the old search portlet then pretty much all the logic you need to manipulate can be done in the JSPs. I have created some very custom Search queries (with filters) and Results (grouped by types in tabs for example) simply by reworking the logic in these JSP files. 

Are you stuck on something?