Created
July 19, 2012 21:51
-
-
Save topolik/3147100 to your computer and use it in GitHub Desktop.
Filtering faceted search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ page import="com.liferay.portal.kernel.search.*" %> | |
<% | |
// should add something like: (+(entryClassName:com.liferay.portlet.documentlibrary.model.DLFileEntry) -(extension:png)) | |
BooleanQuery q1 = BooleanQueryFactoryUtil.create(searchContext); | |
BooleanQuery subQ = BooleanQueryFactoryUtil.create(searchContext); | |
subQ.addTerm("entryClassName", "com.liferay.portlet.documentlibrary.model.DLFileEntry"); | |
q1.add(subQ, BooleanClauseOccur.MUST); | |
BooleanQuery subQ2 = BooleanQueryFactoryUtil.create(searchContext); | |
subQ2.addTerm("extension", "png"); | |
q1.add(subQ2, BooleanClauseOccur.MUST_NOT); | |
BooleanClause bClause = BooleanClauseFactoryUtil.create(searchContext, q1, BooleanClauseOccur.MUST.getName()); | |
searchContext.setBooleanClauses(new BooleanClause[]{bClause}); | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment