Class QueryHandler
- java.lang.Object
-
- com.jalios.jcms.context.JcmsContext
-
- com.jalios.jcms.context.JcmsJspContext
-
- com.jalios.jcms.handler.JcmsFormHandler
-
- com.jalios.jcms.handler.AbstractQueryHandler<Publication>
-
- com.jalios.jcms.handler.QueryHandler
-
- All Implemented Interfaces:
JcmsConstants
,JaliosConstants
- Direct Known Subclasses:
PubChooserHandler
,QueryAppHandler
,WebPageQueryHandler
public class QueryHandler extends AbstractQueryHandler<Publication>
Holder class and form handler of all parameters to be used for a query.There is two main use cases :
- in a jsp, as a java bean form handler (such as in
search.jsp
orrefine.jsp
).
TheQueryHandler
is instanciated with the request property which initializes the bean exactly like aJcmsJspContext
instance, with all contextual informations (specially the logged member). Therefore the query will be performed using access right of theloggedMember
accessing the JSP.<jsp:useBean id="myQueryHandler" scope="page" class="com.jalios.jcms.handler.QueryHandler"> <jsp:setProperty name="myQueryHandler" property="request" value="<%= request %>"/> <jsp:setProperty name="myQueryHandler" property="*" /> </jsp:useBean> <% Set resultSet = myQueryHandler.getResultSet(); %> </pre> </li> <li>in a jsp or in java, as a parameter holder, using default constructor and proper setters.<br> When used a POJO, all parameters must be defined manually, specially, if access right verification is required do not forget to specify the <code>loggedMember</code> to use to perform the query. <pre> QueryHandler myQH = new QueryHandler(); myQH.setLoggedMember( someMember ); // optional Member to be used for access right check myQH.setTypes(new String[] { Article.class.getName() } ); myQH.setText("hello"); Set helloArticleSet = myQH.getResultSet(); ...
If you need to perform a custom query in a jsp, use the jsp tag <jalios:query ... /> which delegates to this class and performs all the processing needed.
- Version:
- $Revision: 135843 $
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.jalios.jcms.handler.AbstractQueryHandler
AbstractQueryHandler.HiddenParamQhPrinter, AbstractQueryHandler.QueryHandlerPrinter, AbstractQueryHandler.QueryStringQhPrinter
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
REVISION
static java.lang.String
TEXT_MODE_ADVANCED
The mode value to use to perform a text search with advanced search syntax (wildcard, field, etc).
Value :"advanced"
.static java.lang.String
TEXT_MODE_ALL_WORDS
The mode value to use to perform a text search matching all the words of the search string.
Value :"all"
.static java.lang.String
TEXT_MODE_ANY_WORD
The mode value to use to perform a text search matching at least one of the words of the search string.
Value :"any"
.static java.lang.String
TEXT_MODE_EXACT
The mode value to use to perform a text search matching the exact phrase specified in the search string.
Value :"exact"
.-
Fields inherited from class com.jalios.jcms.handler.JcmsFormHandler
contextMap, csrfValidationEnabled, editFieldSet, formStep, noRedirect, noSendRedirect, op, opFinish, opNext, opPrevious, popupEdition, redirect, redirectOnClosePopup, workspaceForced
-
Fields inherited from class com.jalios.jcms.context.JcmsJspContext
AJAX_REQUEST_ATTRIBUTES, BODY_HEADER, CSS_FOOTER, CSS_HEADER, cssboMap, cssfoMap, CUSTOM_HEADER, editIcon, HTTPEQUIV_HEADER, httpequivMap, HTTPNAME_HEADER, httpnameMap, initEditIcon, JAVASCRIPT_CODE_SET_ATTRIBUTE, JAVASCRIPT_SET_ATTRIBUTE, jsboSet, jsfoSet, out, pageContext, SHOW_EDIT_ICON, STYLE_HEADER
-
Fields inherited from class com.jalios.jcms.context.JcmsContext
browser, caddy, channel, inFO, initDone, initWorkspace, isAdmin, isAjaxRequest, isDBMember, isDebug, isDebugTemplatePath, isLogged, loggedMember, request, response, userCountry, userLang, userLocale, userZoneId, workspace
-
Fields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
-
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, AJAX_MODE_ATTR, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, CLASS_PROPERTY, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, COUNTRY_SPRITE, CS_TYPOLOGY_ROOT_CAT_VID, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DEFAULT_PHOTO_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, GLYPH_ICON_PREFIX, ICON_ARCHIVE, ICON_ICON_PREFIX, ICON_LOCK, ICON_LOCK_STRONG, ICON_PREFIX_PROP, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, IS_IN_FRONT_OFFICE, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JCMS_TOASTR_COLLECTION, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LANG_SPRITE, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_CREATE_STR, OP_DEEP_COPY, OP_DEEP_COPY_STR, OP_DEEP_DELETE, OP_DEEP_DELETE_STR, OP_DELETE, OP_DELETE_STR, OP_MERGE, OP_MERGE_STR, OP_UPDATE, OP_UPDATE_STR, ORGANIZATION_ROOT_GROUP_PROP, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_PROP_PREFIX, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_PROP_PREFIX, PHOTO_LARGE_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_PROP_PREFIX, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_PROP_PREFIX, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_PROP_PREFIX, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, RAW_CONTENT_ICON_PREFIX, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SECURITY_LOG_FILE, SESSION_AUTHORIZED_FILENAMES_SET, SPRITE_ICON_PREFIX, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, SUCCESS_MSG, SVG_ICON_PREFIX, SVGINLINE_ICON_PREFIX, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, TTCARD_MEDIA_HEIGHT, TTCARD_MEDIA_WIDTH, TYPES_ICON_ALT_PROP, TYPES_ICON_SUFFIX_PROP, TYPES_ICON_TITLE_PROP, TYPES_PREFIX_PROP, TYPES_THUMB_SUFFIX_PROP, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, UPLOAD_PERMISSION_COUNT_PROP_PREFIX, UPLOAD_PERMISSION_SIZE_PROP_PREFIX, URL_REGEXP, VID_LOGGED_MEMBER, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
-
-
Constructor Summary
Constructors Constructor Description QueryHandler()
Default constructor, builds a newQueryHandler
with default value.QueryHandler(QueryHandler original)
Create a QueryHandler by copying all fields of the specified original QueryHandler, omitting all information linked to the current request.QueryHandler(java.lang.String queryString)
Constructs a newQueryHandler
by parsing the specified query string.QueryHandler(java.lang.String text, java.lang.String mode, boolean catName, boolean exactCat, boolean searchInPub, boolean searchInFile, java.lang.String[] cids, java.lang.String[] cidsOff, java.lang.String[] mids, java.lang.String[] midsOff, java.lang.String[] gids, java.lang.String[] gidsOff, java.util.Date beginDate, int beginDay, int beginMonth, int beginYear, java.util.Date endDate, int endDay, int endMonth, int endYear, java.lang.String dateType, int dateSince, java.lang.String[] types, java.lang.String[] typesOff, boolean exactType, java.lang.String[] pstatus, boolean checkPstatus, java.lang.String[] langs, boolean replaceFileDoc)
Constructs a newQueryHandler
, settings all the specified values.QueryHandler(java.lang.String queryString, javax.servlet.http.HttpServletRequest request)
Constructs a newQueryHandler
by parsing the specified query string and using informations available from the specified request (logged member, user language, etc).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHighlightAttributes(javax.servlet.http.HttpServletRequest request)
Add highlight attributes to the given request.void
appendAdvanced(java.lang.String key, java.lang.Object value)
void
appendAdvanced(java.lang.String key, java.lang.Object[] values)
void
clearHighlightAttributes(javax.servlet.http.HttpServletRequest request)
Remove highlight attributes of the given request.java.lang.String
getAbility()
Retrieves the current the portal element's ability defined for this QueryHandler.java.lang.String
getAdvanced()
java.util.Set<java.lang.String>
getAllCidSet()
Returns all the cids contained in this query and all historized queries.java.util.Date[]
getBeginAndEndDates()
Compute begin and end date of a query from QueryHandler values.java.util.Date
getBeginDate()
Retrieve the begin date used in range search.int
getBeginDay()
int
getBeginMonth()
int
getBeginYear()
java.util.Set<Category>
getCategorySet(java.lang.String inputName)
java.lang.String
getCatMode()
Retrieve the mode to use when dealing with categories.boolean
getCatName()
boolean
getCheckPstatus()
java.lang.String[]
getCids()
java.lang.String[]
getCidsOff()
java.util.HashSet<java.lang.Class<? extends Publication>>
getClassOffSet()
Return a set of classes corresponding to the 'typesOff' attributesjava.util.HashSet<java.lang.Class<? extends Publication>>
getClassSet()
Return a set of classes corresponding to the 'types' attributesjava.lang.String[]
getContentLangs()
Retrieve the language in which text search is performed.static java.util.List<java.lang.String>
getContentTypesFromDocumentKind(java.lang.String kind)
Retrieve the content type to use for the specified document kindint
getDateSinceInt()
java.lang.String
getDateType()
Retrieve the date type being used for date range search.java.lang.String
getDescription()
Returns a description of the query in the language defined by userLang of this handler.java.lang.String
getDescription(java.lang.String lang)
Returns a description of the query in the specified language.java.lang.String[]
getDocumentKinds()
Retrieve the kind of document defined for this QueryHandlerstatic java.util.Map<java.lang.String,java.lang.String>
getDocumentKindsGroupMap(java.lang.String userLang)
Retrieve a map of all document kind group defined in properties.static java.util.Map<java.lang.String,java.lang.String>
getDocumentKindsMap(java.lang.String userLang, java.lang.String kindGroup)
Retrieve a map of all document kind for the specified kind group.java.util.Date
getEndDate()
Retrieve the end date being used in range searchint
getEndDay()
int
getEndMonth()
int
getEndYear()
boolean
getExactCat()
boolean
getExactType()
java.lang.String[]
getGids()
java.lang.String[]
getGidsOff()
Member
getHighlightedMember()
java.lang.String
getHist()
int
getHistLevel()
java.util.List<java.lang.String>
getHistoryList()
Not set : - before the query method has been called.int[]
getIntPstatus()
Retrieves the current pstatus values to be searched by this query.java.lang.String[]
getLangs()
Retrieve the language in which publications must have been translated to be part of the results.protected org.apache.log4j.Logger
getLogger()
java.lang.String[]
getMids()
java.lang.String[]
getMidsOff()
java.lang.String[]
getMidsOpAuthor()
Retrieve the opAuthor that publication must match in order to be foundjava.lang.String
getMode()
Retrieve the string representation of the current text mode being to perform the text search.protected java.lang.String[]
getMostRecentTextAndModeInHistory()
protected static void
getMostRecentTextInHistoryVisitor(java.lang.String[] textAndMode, QueryHandler qh)
Internal recursive method used to look for most recent text.boolean
getPagerAll()
int
getPageSize()
java.lang.String[]
getPortalIds()
java.lang.String[]
getPstatus()
Retrieves the pstatus values to be searched by this query.java.util.Map<java.lang.String,java.lang.Object>
getQueryFilterContext()
Workspace
getRefinedWorkspace()
Get the Workspace for this request.boolean
getReplaceFileDoc()
java.util.Set<Workspace>
getResolvedWorkspaceSet()
Retrieve the Set of Workspace on which the query is refined.QueryResultSet
getResultSet()
Return results of a query done using thisQueryHandler
.boolean
getReverse()
java.lang.String[]
getSearchedFields()
Retrieves the lucene fields in which the text search is being performed for publications.boolean
getSearchInDB()
boolean
getSearchInFiles()
boolean
getSearchInMembers()
boolean
getSearchInPub()
boolean
getSearchInSubWorkspaces()
Gets whether search is performed on the exact specified workspace(s) or by also including their children.boolean
getSearchInTrash()
Get option indicating if content in trash are included in result or not.java.lang.String
getSort()
int
getStart()
java.lang.String
getText()
Retrieve the current text being searched in this query.boolean
getTextSearch()
Checks if this query is mainly a text search.java.lang.String[]
getTypes()
static java.lang.Class<? extends Publication>
getTypesCommonSuperClass(QueryHandler... queryHandlers)
Retrieve the common super class of types specified in the QueryHandler.java.lang.String[]
getTypesOff()
java.lang.String[]
getUnresolvedContentLangs()
Retrieve the language in which text search is performed.java.lang.String[]
getUnresolvedLangs()
Retrieve the language in which publications must have been translated to be part of the results.java.lang.String
getUserLang()
Retrieves the user lang variable for this context.
Fast: this method is cached using initDone (it is recomputed only on forceUpdate() or setRequest()).java.lang.String
getWfId()
java.util.Set<Workspace>
getWorkspaceSet()
Retrieve the Set of Workspace on which the query was initially refined.boolean
isExpanded(Category cat, java.lang.String inputName)
boolean
isHybridSearch()
Returns true if this is an hybrid search (i.e.boolean
isModeAdvanced()
Checks if the current text mode is to perform the search using advanced search syntaxt.boolean
isModeAll()
Checks if the current text mode is to find all words of the search string.boolean
isModeAny()
Checks if the current text mode is to find at least one word of the search string.boolean
isModeExact()
Checks if the current text mode is to find the exact phrase specified in the search string.protected void
parseQueryStringParam(java.lang.String key, java.lang.String[] values)
Method to be implemented by subclass to decode parameter from queryString.protected java.lang.String
printParams(AbstractQueryHandler.QueryHandlerPrinter printer)
Print current QueryHandler params using specified QueryHandlerPrinter.void
setAbility(java.lang.String ability)
Sets the portal element's ability to match when PortalElement are found.void
setAdvanced(java.lang.String advanced)
void
setBeginDate(java.util.Date date)
Set the begin date for range search.void
setBeginDateStr(java.lang.String dateStr)
Set the begin date using value received from a JCMS date chooser in the current user language.void
setBeginDateW3c(java.lang.String dateW3c)
Set the begin date to be used in this query.void
setBeginDay(int v)
void
setBeginMonth(int v)
void
setBeginYear(int v)
void
setCatMode(java.lang.String v)
Define the mode to use when dealing with categories.void
setCatName(boolean v)
void
setCheckPstatus(boolean v)
void
setCids(java.lang.String... v)
void
setCidsOff(java.lang.String... v)
void
setContentLangs(java.lang.String... langArray)
The language(s) in which text search will be performed, that is, the language(s) of the publications' fields values in which to search for the specified text.void
setDateSince(int v)
void
setDateSince(java.lang.String v)
void
setDateType(java.lang.String type)
Set the date type being used for date range search.void
setDocumentKinds(java.lang.String... kinds)
Set the kind of document to match for this QueryHandlervoid
setEndDate(java.util.Date date)
Set the end date for range search.void
setEndDateStr(java.lang.String dateStr)
Set the end date using value received from a JCMS date chooser in the current user language.void
setEndDateW3c(java.lang.String dateW3c)
Set the end date to be used in this query.void
setEndDay(int v)
void
setEndMonth(int v)
void
setEndYear(int v)
void
setExactCat(boolean v)
void
setExactType(boolean v)
void
setGids(java.lang.String... v)
void
setGidsOff(java.lang.String... v)
void
setHist(java.lang.String v)
void
setHistLevel(int v)
void
setHistoryList(java.util.List<java.lang.String> historyList)
Set the list of descriptions of the query and the query recursively in "hist" request param.void
setIgnoreDefaultTypes(boolean ignoreDefaultTypes)
void
setLangs(java.lang.String... langArray)
The language(s) in which publications must have been translated to be part of the results.void
setMids(java.lang.String... v)
void
setMidsOff(java.lang.String... v)
void
setMidsOpAuthor(java.lang.String... ids)
Set opAuthor that publication must match in order to be found.void
setMode(java.lang.String m)
Define the text mode to use to perform the text search.void
setPagerAll(boolean pagerAll)
void
setPageSize(int pageSize)
void
setPortalIds(java.lang.String... v)
void
setPstatus(java.lang.String... pstatus)
Sets the pstatus values to be searched by this query.void
setReplaceFileDoc(boolean v)
void
setReverse(boolean v)
void
setSearchedFields(java.lang.String... searchedFields)
Defines the (lucene) publications fields in which to perform the text search.void
setSearchInDB(boolean v)
void
setSearchInFiles(boolean v)
void
setSearchInMembers(boolean v)
void
setSearchInPub(boolean v)
void
setSearchInSubWorkspaces(boolean searchInSubWorkspaces)
Set whether to perform search on the exact specified workspace(s) or on their children too.void
setSearchInTrash(boolean searchInTrash)
Set option indicating if content in trash are included in result or not.void
setSort(java.lang.String sort)
void
setStart(int start)
void
setText(java.lang.String text)
Sets the text to search in this query. Default value isnull
.void
setTextSearch(boolean textSearch)
Indicate whether the search being performed through this query is a mainly a text search prior to other things. Default value isfalse
.void
setTypes(java.lang.String... types)
void
setTypesOff(java.lang.String... typesOff)
void
setWfId(java.lang.String wfId)
void
setWorkspace(Workspace wspc)
Set the only workspace that publication must belong.void
setWorkspaceSet(java.util.Set<Workspace> wsSet)
Set the Workspaces that publication must belong.void
setWrkspc(java.lang.String... wsIds)
Set the workspaces ids that publication must belong.java.lang.String
toString()
protected static java.lang.String[]
validateTypesArray(java.lang.String[] types)
Validate the specified types array-
Methods inherited from class com.jalios.jcms.handler.AbstractQueryHandler
getAttribute, getAttributeMap, getDataSet, getHiddenParams, getQueryString, init, parseQueryString, removeAttribute, setAttribute, setDataSet
-
Methods inherited from class com.jalios.jcms.handler.JcmsFormHandler
afterValidation, checkMissingField, getAvailableMainLanguage, getClosePopupUrl, getControllerContext, getEditFieldSet, getFormStep, getFormStepCount, getFormStepFinishLabel, getFormStepHiddenFields, getFormStepLabels, getFormStepPrefixProp, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenFieldML, getMainLangValue, getMainLangValueArray, getMLMap, getMLMapArray, getModalRedirect, getMonolingualValue, getMonolingualValueArray, getMultilingualMainValue, getMultilingualMainValueArray, getMultilingualMLMap, getMultilingualMLMapArray, getRedirect, getRedirectOnClosePopup, getWorkspace, init, isFieldEdition, isFieldMissing, isFormStepClickable, isPartialFieldEdition, isPopupEdition, isWorkspaceForced, mapStringArrayToMapStringList, mapStringListToMapStringArray, mustSendForbiddenOnCSRF, performFinish, performNext, performPrevious, processAction, processStatus, sanitize, sanitize, sendRedirect, sendRedirect, setEditField, setFormStep, setNoRedirect, setNoSendRedirect, setOpFinish, setOpNext, setOpPrevious, setPopupEdition, setRedirect, setRedirectOnClosePopup, setWs, showCancelButton, showFinishButton, showNextButton, showPreviousButton, updateUploadedField, updateUploadedFields, updateUploadedFields, validate, validateCSRF, validateFinish, validateNext, validatePrevious
-
Methods inherited from class com.jalios.jcms.context.JcmsJspContext
addAvoidanceLink, addBodyAttributes, addCSSHeader, addCSSHeader, addCSSHeader, addCSSHeader, addCustomHeader, addHandlebarTemplate, addHttpEquivHeader, addHttpNameHeader, addJavaScript, addJavaScript, addJavaScript, addJavaScriptCode, addPrefetchHeader, addStyleHeader, addStyleHeader, addWebAssets, checkAccess, checkAccess, checkCSRF, debugDisplayContext, disablePacker, forceEditIcon, forceUpdate, getAjaxRequestAttribute, getAjaxRequestId, getAllHeadersDiffMap, getAllHeadersMap, getAvoidanceLinks, getBackOfficeCSSHeader, getBackOfficeJavaScriptSet, getBodyAttributes, getContentForm, getCSSHeaders, getCtxCategories, getCurrentCategory, getCustomHeaders, getDocType, getFinalCSSFooterMap, getFinalCSSMap, getFinalJavaScriptSet, getFrontOfficeCSSHeader, getFrontOfficeJavaScriptSet, getHandlebarTemplates, getHttpEquivHeaders, getHttpNameHeaders, getJavaScriptCodeSet, getJavaScriptSet, getJSONBridge, getPageContext, getPageTitle, getPageZone, getPortal, getPortalCategory, getPortlet, getPublication, getStyleHeaders, getTemplateUsage, internalSetupEmptyHeader, isEditIcon, isEditIcon, isEditIconForPublish, isEditIconForPublish, isPrintView, registerDisplayContext, removeAjaxRequestAttribute, setAjaxRequestAttribute, setAjaxRequestId, setAllHeadersDiffMap, setDocType, setEditIcon, setPageContext, setPageTitle, setPageZone, setShowEditIcon, setTemplateUsage, showEditIcon, showEditIcon, showEditIcon, workaroundBrowserBaseHrefBug
-
Methods inherited from class com.jalios.jcms.context.JcmsContext
addCookie, addMsg, addMsg, addMsgSession, addMsgSession, addToastr, addToastr, addToastrSession, addToastrSession, applySelector, forceWorkspaceUpdate, getBaseUrl, getBrowser, getCaddy, getContextPath, getErrorMsg, getErrorMsgList, getErrorMsgSession, getErrorMsgSessionList, getInfoMsg, getInfoMsgList, getInfoMsgSession, getInfoMsgSessionList, getLoggedMember, getMsgList, getMsgSessionList, getRequest, getResponse, getSession, getSuccessMsg, getSuccessMsgList, getSuccessMsgSession, getSuccessMsgSessionList, getToastrCollection, getToastrSessionCollection, getUploadedFile, getUploadedFileList, getUploadedFiles, getUploadedFiles, getUrlWithCommonUpdatedParams, getUserCountry, getUserLocale, getUserZoneId, getWarningMsg, getWarningMsgList, getWarningMsgSession, getWarningMsgSessionList, glp, isAdmin, isAdminZone, isAjaxRequest, isDBMember, isDebug, isDebugTemplate, isInFrontOffice, isLogged, isWebdavAccess, isWorkZone, removeMessage, removeMessage, retrieveUploadedFile, select, sendError, sendError, sendForbidden, sendForbidden, sendRedirect, sendRedirect, sendRedirect, setErrorMsg, setErrorMsg, setErrorMsgSession, setErrorMsgSession, setInfoMsg, setInfoMsg, setInfoMsgSession, setInfoMsgSession, setLoggedMember, setRequest, setResponse, setSuccessMsg, setSuccessMsg, setSuccessMsgSession, setSuccessMsgSession, setWarningMsg, setWarningMsg, setWarningMsgSession, setWarningMsgSession, updateWorkspace, validateRegexp, validateSchedule
-
-
-
-
Field Detail
-
REVISION
public static final java.lang.String REVISION
- See Also:
- Constant Field Values
-
TEXT_MODE_ALL_WORDS
public static final java.lang.String TEXT_MODE_ALL_WORDS
The mode value to use to perform a text search matching all the words of the search string.
Value :"all"
.- Since:
- jcms-5.6.2
- See Also:
setMode(String)
, Constant Field Values
-
TEXT_MODE_ANY_WORD
public static final java.lang.String TEXT_MODE_ANY_WORD
The mode value to use to perform a text search matching at least one of the words of the search string.
Value :"any"
.- Since:
- jcms-5.6.2
- See Also:
setMode(String)
, Constant Field Values
-
TEXT_MODE_EXACT
public static final java.lang.String TEXT_MODE_EXACT
The mode value to use to perform a text search matching the exact phrase specified in the search string.
Value :"exact"
.- Since:
- jcms-5.6.2
- See Also:
setMode(String)
, Constant Field Values
-
TEXT_MODE_ADVANCED
public static final java.lang.String TEXT_MODE_ADVANCED
The mode value to use to perform a text search with advanced search syntax (wildcard, field, etc).
Value :"advanced"
.- Since:
- jcms-5.6.2
- See Also:
setMode(String)
, Constant Field Values
-
-
Constructor Detail
-
QueryHandler
public QueryHandler()
Default constructor, builds a newQueryHandler
with default value. This constructor is required to use this class as a java bean.
-
QueryHandler
public QueryHandler(java.lang.String text, java.lang.String mode, boolean catName, boolean exactCat, boolean searchInPub, boolean searchInFile, java.lang.String[] cids, java.lang.String[] cidsOff, java.lang.String[] mids, java.lang.String[] midsOff, java.lang.String[] gids, java.lang.String[] gidsOff, java.util.Date beginDate, int beginDay, int beginMonth, int beginYear, java.util.Date endDate, int endDay, int endMonth, int endYear, java.lang.String dateType, int dateSince, java.lang.String[] types, java.lang.String[] typesOff, boolean exactType, java.lang.String[] pstatus, boolean checkPstatus, java.lang.String[] langs, boolean replaceFileDoc)
Constructs a newQueryHandler
, settings all the specified values.This constructors, while not deprecated, should not be used. Prefer the default constructor, followed by calls to the propers setters.
- Parameters:
text
- the text to be search, seesetText(String)
mode
- the text search mode to use, seesetMode(String)
catName
- whether to perform text search in categories, seesetCatName(boolean)
exactCat
- whether to find publication only when they have one of the category tosetCatName(boolean)
searchInPub
- whether to perform text search in publication, seesetSearchInPub(boolean)
searchInFile
- whether to perform text search in files, seesetSearchInFiles(boolean)
cids
- an array of Category's ids that publication must match to be found, seesetCids(String...)
cidsOff
- an array of Category's ids that publication must NOT match to be found, seesetCidsOff(String...)
mids
- an array of Member's ids defining the authors the publication must match to be found, seesetMids(String...)
midsOff
- an array of Member's ids defining the authors the publication must NOT match to be found, seesetMidsOff(String...)
gids
- an array of Group's ids defining the group that the author of the publication must belong to in order for a publication to be found, seesetGids(String...)
gidsOff
- an array of Group's ids defining the group that the author of the publication must NOT belong to in order for a publication to be found, seesetGidsOff(String...)
beginDate
- the begin datebeginDay
- the begin daybeginMonth
- the begin monthbeginYear
- the begin yearendDate
- the end dateendDay
- the end dayendMonth
- the end monthendYear
- the end yeardateType
- the date typedateSince
- the date since valuetypes
- an array of types that publication must match to be foundtypesOff
- an array of types that publication must NOT match to be foundexactType
- search only for exact type (no sub types)pstatus
- the pstatus searchedcheckPstatus
- should the pstatus be checkedlangs
- the languagesreplaceFileDoc
- should the FileDocument be replaced by their refereres
-
QueryHandler
public QueryHandler(java.lang.String queryString)
Constructs a newQueryHandler
by parsing the specified query string.See
QueryHandler(String, HttpServletRequest)
for a list of the decoded parameters.- Parameters:
queryString
- a query String consisting of parameters (key=value) to be set in this handler.- Parameters must be separated with ampersand (&).
- Values must be encoded in UTF-8.
- Query must not starts with question mark (?)
e.g :
"text=welcome&cids=j_42&cids=j_78"
-
QueryHandler
public QueryHandler(java.lang.String queryString, javax.servlet.http.HttpServletRequest request)
Constructs a newQueryHandler
by parsing the specified query string and using informations available from the specified request (logged member, user language, etc).The following parameters (and only those listed here) will be automatically decoded from the specified query string. Other parameters should be set using apropriate setters.
"text"
:setText(String)
"mode"
:setMode(String)
"catName"
:setCatName(boolean)
"exactCat"
:setExactCat(boolean)
"searchInPub"
:setSearchInPub(boolean)
"searchInFiles"
:setSearchInFiles(boolean)
"catMode"
:setCatMode(String)
"cids"
:setCids(String...)
"cidsOff"
:setCidsOff(String...)
"mids"
:setMids(String...)
"midsOff"
:setMidsOff(String...)
"gids"
:setGids(String...)
"gidsOff"
:setGidsOff(String...)
"portalIds"
:setPortalIds(String...)
"dateType"
:setDateType(String)
"dateSince"
:setDateSince(String)
"beginDay"
:setBeginDay(int)
"beginMonth"
:setBeginMonth(int)
"beginYear"
:setBeginYear(int)
"beginDateW3c"
:setBeginDateW3c(String)
"endDay"
:setEndDay(int)
"endMonth"
:setEndMonth(int)
"endYear"
:setEndYear(int)
"endDateW3c"
:setEndDateW3c(String)
"hist"
:setHist(String)
"sort"
:setSort(String)
"types"
:setTypes(String...)
"typesOff"
:setTypesOff(String...)
"exactType"
:setExactType(boolean)
"pstatus"
:setPstatus(String...)
"langs"
:setLangs(String...)
"contentLangs"
:setContentLangs(String...)
"replaceFileDoc"
:setReplaceFileDoc(boolean)
"wrkspc"
:setWrkspc(String...)
"searchedFields"
:setSearchedFields(String...)
"ability"
:setAbility(String)
"searchInSubWorkspaces"
:setSearchInSubWorkspaces(boolean)
- Parameters:
queryString
- a query String consisting of parameters (key=value) to be set in this handler.- Parameters must be separated with ampersand (&).
- Values must be encoded in UTF-8.
- Query must not starts with question mark (?)
e.g :
"text=welcome&cids=j_42&cids=j_78"
request
- theHttpServletRequest
to use to retrieveloggedMember
,userLang
,userLocale
that will be used by this handler, ignored if null.
-
QueryHandler
public QueryHandler(QueryHandler original)
Create a QueryHandler by copying all fields of the specified original QueryHandler, omitting all information linked to the current request.As of current implementation the following parameters are copied :
- All fields managed by the querystring
- data set, see
AbstractQueryHandler.setDataSet(Set)
- logged member, see
JcmsContext.setLoggedMember(Member)
- workspaceSet if available, see
setWorkspaceSet(Set)
, else workspace, seesetWorkspace(Workspace)
- check pstatus option, see
setCheckPstatus(boolean)
- all attributes, see
AbstractQueryHandler.getAttributeMap()
- Parameters:
original
- the original QueryHandler from which to retrieve parameters- Since:
- jcms-5.7.2
-
-
Method Detail
-
getLogger
protected org.apache.log4j.Logger getLogger()
- Specified by:
getLogger
in classAbstractQueryHandler<Publication>
-
parseQueryStringParam
protected void parseQueryStringParam(java.lang.String key, java.lang.String[] values)
Description copied from class:AbstractQueryHandler
Method to be implemented by subclass to decode parameter from queryString.- Specified by:
parseQueryStringParam
in classAbstractQueryHandler<Publication>
- Parameters:
key
- the parameter name, never null nor empty.values
- the parameter values, NEVER NULL NOR EMPTY. You can safely invokeparamValues[0]
-
printParams
protected java.lang.String printParams(AbstractQueryHandler.QueryHandlerPrinter printer)
Print current QueryHandler params using specified QueryHandlerPrinter.- Specified by:
printParams
in classAbstractQueryHandler<Publication>
- Parameters:
printer
- a QueryHandlerPrinter to use- Returns:
- a string containing all parameters of this handler printed using specified QueryHandlerPrinter.
- Since:
- jcms-5.7.4
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getResultSet
public QueryResultSet getResultSet()
Return results of a query done using thisQueryHandler
.Warning: This method process the query each time it is invoked, therefore do not call it multiple times if you don't need it.
- Returns:
- a
QueryResultSet
containing all results of this query, it is aHashSet
and therefore it is NOT sorted. use eithergetAsSortedSet()
orgetAsSortedSet(Comparator)
to obtain a sorted Set. - Since:
- jcms-5.0.0
-
getCategorySet
public java.util.Set<Category> getCategorySet(java.lang.String inputName)
-
isExpanded
public boolean isExpanded(Category cat, java.lang.String inputName)
-
setIgnoreDefaultTypes
public void setIgnoreDefaultTypes(boolean ignoreDefaultTypes)
- Parameters:
ignoreDefaultTypes
- if true, getTypes() and getTypesOff() won't check the properties for default query types and types off.- Since:
- jcms-5.0.0
-
getRefinedWorkspace
public Workspace getRefinedWorkspace()
Get the Workspace for this request.- Returns:
- a Workspace
-
getWorkspaceSet
public java.util.Set<Workspace> getWorkspaceSet()
Retrieve the Set of Workspace on which the query was initially refined.- Returns:
- a Set of Workspace. Return an empty set when searching in all workspace or in logged member workspace, never return null.
- Since:
- jcms-7.1.3, jcms-8.0.0, JCMS-3331
-
getResolvedWorkspaceSet
public java.util.Set<Workspace> getResolvedWorkspaceSet()
Retrieve the Set of Workspace on which the query is refined.This set is computed :
- from value(s) specified to one (and only one) of the following method :
JcmsFormHandler.setWs(String)
,setWrkspc(String...)
,setWorkspace(Workspace)
andsetWorkspaceSet(Set)
. - the state of the
setSearchInSubWorkspaces(boolean)
option
- Returns:
- a Set of Workspace. Return an empty set when searching in all workspace, never return null.
- Since:
- jcms-7.1.3, jcms-8.0.0, JCMS-3331
- from value(s) specified to one (and only one) of the following method :
-
setWrkspc
public void setWrkspc(java.lang.String... wsIds)
Set the workspaces ids that publication must belong.This method also accepts the unique
"user"
value to trigger a search in the workspaces the logged member belong (cf improvement JCMS-4857).Default behavior of query handler is to search in all workspaces.
This method is exclusive with
JcmsFormHandler.setWs(String)
,setWorkspace(Workspace)
andsetWorkspaceSet(Set)
.- Parameters:
wsIds
- one or several ids of Workspace, unique value"user"
to search in logged member workspaces, or null/empty values to search in all workspaces- See Also:
setSearchInSubWorkspaces(boolean)
-
setWorkspace
public void setWorkspace(Workspace wspc)
Set the only workspace that publication must belong.Default behavior of query handler is to search in all workspaces.
This method is exclusive with
setWrkspc(String...)
,JcmsFormHandler.setWs(String)
, andsetWorkspaceSet(Set)
.- Overrides:
setWorkspace
in classJcmsFormHandler
- Parameters:
wspc
- a Workspace or null to search in all workspaces- Since:
- jcms-7.1.3, jcms-8.0.0
- See Also:
JcmsFormHandler.setWorkspace(com.jalios.jcms.workspace.Workspace)
-
setWorkspaceSet
public void setWorkspaceSet(java.util.Set<Workspace> wsSet)
Set the Workspaces that publication must belong.Default behavior of query handler is to search in all workspaces.
This method is exclusive with
setWrkspc(String...)
,JcmsFormHandler.setWs(String)
, andsetWorkspace(Workspace)
.- Parameters:
wsSet
- a Set of Workspace to refine on.- Since:
- jcms-7.1.3, jcms-8.0.0, JCMS-3331
- See Also:
setSearchInSubWorkspaces(boolean)
-
getAllCidSet
public java.util.Set<java.lang.String> getAllCidSet()
Returns all the cids contained in this query and all historized queries.- Returns:
- a set of cids
-
getUserLang
public java.lang.String getUserLang()
Description copied from class:JcmsContext
Retrieves the user lang variable for this context.
Fast: this method is cached using initDone (it is recomputed only on forceUpdate() or setRequest()).- Overrides:
getUserLang
in classJcmsContext
- Returns:
- the user lang (define in InitFilter, guessed either from logged member lang, userLang portlet action, http request Accept-Language header, or defaut channel language
-
getDescription
public java.lang.String getDescription()
Returns a description of the query in the language defined by userLang of this handler.- Returns:
- the string of the description
-
getDescription
public java.lang.String getDescription(java.lang.String lang)
Returns a description of the query in the specified language.- Parameters:
lang
- the ISO-639 code of the language in which to retrieve the query description- Returns:
- the string of the description
-
getBeginAndEndDates
public java.util.Date[] getBeginAndEndDates()
Compute begin and end date of a query from QueryHandler values.- Returns:
- an array of two
Date
, the first is the begin date, the second the end Date.
-
getHighlightedMember
public Member getHighlightedMember()
-
getClassSet
public java.util.HashSet<java.lang.Class<? extends Publication>> getClassSet()
Return a set of classes corresponding to the 'types' attributes- Returns:
- a set of class
-
getClassOffSet
public java.util.HashSet<java.lang.Class<? extends Publication>> getClassOffSet()
Return a set of classes corresponding to the 'typesOff' attributes- Returns:
- a set of class
-
getMostRecentTextInHistoryVisitor
protected static void getMostRecentTextInHistoryVisitor(java.lang.String[] textAndMode, QueryHandler qh)
Internal recursive method used to look for most recent text.- Parameters:
textAndMode
- MUST be an allocated array of String[2] that will be filled with the text and mode if available.qh
- the QueryHandler
-
getMostRecentTextAndModeInHistory
protected java.lang.String[] getMostRecentTextAndModeInHistory()
- Returns:
- the most recent text in the search history and the mode used, as an array of 2 String, with text as first and mode as second. this method is NOT CACHED and quite SLOW, cache the result yourself. (Used by highlight).
-
addHighlightAttributes
public void addHighlightAttributes(javax.servlet.http.HttpServletRequest request)
Add highlight attributes to the given request.- Parameters:
request
- the current request
-
clearHighlightAttributes
public void clearHighlightAttributes(javax.servlet.http.HttpServletRequest request)
Remove highlight attributes of the given request.- Parameters:
request
- the current request
-
setMode
public void setMode(java.lang.String m)
Define the text mode to use to perform the text search.- Parameters:
m
- a string representing the mode to use, from one of those values : The specified string will be kept only if choosen from thoses values.
-
getMode
public java.lang.String getMode()
Retrieve the string representation of the current text mode being to perform the text search.- Returns:
- a string from one of the valid values in
- See Also:
setMode(String)
-
isModeAll
public boolean isModeAll()
Checks if the current text mode is to find all words of the search string.- Returns:
- true if
getMode()
equalsTEXT_MODE_ALL_WORDS
, false otherwise. - Since:
- jcms-5.6.2
-
isModeAny
public boolean isModeAny()
Checks if the current text mode is to find at least one word of the search string.- Returns:
- true if
getMode()
equalsTEXT_MODE_ANY_WORD
, false otherwise. - Since:
- jcms-5.6.2
-
isModeExact
public boolean isModeExact()
Checks if the current text mode is to find the exact phrase specified in the search string.- Returns:
- true if
getMode()
equalsTEXT_MODE_EXACT
, false otherwise. - Since:
- jcms-5.6.2
-
isModeAdvanced
public boolean isModeAdvanced()
Checks if the current text mode is to perform the search using advanced search syntaxt.- Returns:
- true if
getMode()
equalsTEXT_MODE_ADVANCED
, false otherwise. - Since:
- jcms-5.6.2
-
setText
public void setText(java.lang.String text)
Sets the text to search in this query. Default value isnull
.The specified text will be search in publications/categories/archives/files depending on other parameters of this query, see
setSearchInPub(boolean)
,setCatName(boolean)
.The specified text will be search in various way depending on the search mode, see
setMode(String)
for more information.- Parameters:
text
- a String to be searched
-
getText
public java.lang.String getText()
Retrieve the current text being searched in this query.- Returns:
- a String, may be null if no text search is being performed.
-
setTextSearch
public void setTextSearch(boolean textSearch)
Indicate whether the search being performed through this query is a mainly a text search prior to other things. Default value isfalse
.The changing behavior occurs when setting the text to null or an empty string : if set to
true
, the query will returns an empty result set, if set tofalse
the query will be performed with other parameters.- Parameters:
textSearch
-true
to indicate that this query is a text search,false
otherwise.
-
getTextSearch
public boolean getTextSearch()
Checks if this query is mainly a text search.- Returns:
- true if this query is mainly a text search, false if this query is not specifically decicated to text search.
- See Also:
setTextSearch(boolean)
-
getCatName
public boolean getCatName()
-
setCatName
public void setCatName(boolean v)
-
getExactCat
public boolean getExactCat()
-
setExactCat
public void setExactCat(boolean v)
-
getSearchInPub
public boolean getSearchInPub()
-
setSearchInPub
public void setSearchInPub(boolean v)
-
getSearchInFiles
public boolean getSearchInFiles()
-
setSearchInFiles
public void setSearchInFiles(boolean v)
-
getSearchInDB
public boolean getSearchInDB()
-
setSearchInDB
public void setSearchInDB(boolean v)
-
getSearchInMembers
public boolean getSearchInMembers()
-
setSearchInMembers
public void setSearchInMembers(boolean v)
-
getSearchInSubWorkspaces
public boolean getSearchInSubWorkspaces()
Gets whether search is performed on the exact specified workspace(s) or by also including their children.- Returns:
- true to search in children workspace(s) of the workspace(s) specified, false to search only in the exact workspace(s) specified.
- Since:
- jcms-7.1.3, jcms-8.0.0, JCMS-3331
- See Also:
setSearchInSubWorkspaces(boolean)
-
setSearchInSubWorkspaces
public void setSearchInSubWorkspaces(boolean searchInSubWorkspaces)
Set whether to perform search on the exact specified workspace(s) or on their children too.Default behavior is to search only in the exact workspaces specified (if any).
- Parameters:
searchInSubWorkspaces
- set to true to search in children workspace(s) of the workspace(s) specified, false to search only in the exact workspace(s) specified.- Since:
- jcms-7.1.3, jcms-8.0.0, JCMS-3331
- See Also:
setWrkspc(String...)
,setWorkspaceSet(Set)
-
getCids
public java.lang.String[] getCids()
-
setCids
public void setCids(java.lang.String... v)
-
getCidsOff
public java.lang.String[] getCidsOff()
-
setCidsOff
public void setCidsOff(java.lang.String... v)
-
getMids
public java.lang.String[] getMids()
-
setMids
public void setMids(java.lang.String... v)
-
getMidsOff
public java.lang.String[] getMidsOff()
-
setMidsOff
public void setMidsOff(java.lang.String... v)
-
getMidsOpAuthor
public java.lang.String[] getMidsOpAuthor()
Retrieve the opAuthor that publication must match in order to be found- Returns:
- the current opAuthor refinement ids
- Since:
- jcms-10.0.5 / JCMS-8387
-
setMidsOpAuthor
public void setMidsOpAuthor(java.lang.String... ids)
Set opAuthor that publication must match in order to be found.Value
"loggedMember"
may be set to query the Publication whose opAuthor is current logged Member.- Parameters:
ids
- Member ids- Since:
- jcms-10.0.5 / JCMS-8387
-
getGids
public java.lang.String[] getGids()
-
setGids
public void setGids(java.lang.String... v)
-
getGidsOff
public java.lang.String[] getGidsOff()
-
setGidsOff
public void setGidsOff(java.lang.String... v)
-
getPortalIds
public java.lang.String[] getPortalIds()
-
setPortalIds
public void setPortalIds(java.lang.String... v)
-
getBeginDate
public java.util.Date getBeginDate()
Retrieve the begin date used in range search.- Returns:
- the begin date being used
-
setBeginDate
public void setBeginDate(java.util.Date date)
Set the begin date for range search.Setting this date will automatically update the begin day, begin month and begin year values accordingly so that begin date is kept in query string (behavior introduce in JCMS 9)
- Parameters:
date
- the end date to use in date range search
-
setBeginDateStr
public void setBeginDateStr(java.lang.String dateStr)
Set the begin date using value received from a JCMS date chooser in the current user language.- Parameters:
dateStr
- the date (as formatted by a date chooser)- See Also:
Channel.getDateFormat(String)
-
setBeginDateW3c
public void setBeginDateW3c(java.lang.String dateW3c)
Set the begin date to be used in this query.Setting this date will automatically update the begin day, end month and end year values accordingly so that begin date is kept in query string (behavior introduce in JCMS 9)
- Parameters:
dateW3c
- a date formatted using W3C format, seeDateUtil.parseW3cDate(String)
for more information on this format.- Since:
- jcms-5.7.2
- See Also:
setBeginDate(Date)
-
getEndDate
public java.util.Date getEndDate()
Retrieve the end date being used in range search- Returns:
- the end date being used
-
setEndDate
public void setEndDate(java.util.Date date)
Set the end date for range search.Setting this date will automatically update the end day, end month and end year values accordingly so that end date is kept in query string (behavior introduce in JCMS 9)
- Parameters:
date
- the end date to use in date range search
-
setEndDateStr
public void setEndDateStr(java.lang.String dateStr)
Set the end date using value received from a JCMS date chooser in the current user language.Setting this date will automatically update the end day, end month and end year values accordingly so that end date is kept in query string (behavior introduce in JCMS 9)
- Parameters:
dateStr
- the date (as formatted by a date chooser)- Since:
- jcms-9.0
- See Also:
Channel.getDateFormat(String)
,setEndDate(Date)
-
setEndDateW3c
public void setEndDateW3c(java.lang.String dateW3c)
Set the end date to be used in this query.Setting this date will automatically update the end day, end month and end year values accordingly so that end date is kept in query string (behavior introduce in JCMS 9)
- Parameters:
dateW3c
- a date formatted using W3C format, seeDateUtil.parseW3cDate(String)
for more information on this format.- Since:
- jcms-5.7.2
- See Also:
setEndDate(Date)
-
getBeginDay
public int getBeginDay()
-
setBeginDay
public void setBeginDay(int v)
-
getBeginMonth
public int getBeginMonth()
-
setBeginMonth
public void setBeginMonth(int v)
-
getBeginYear
public int getBeginYear()
-
setBeginYear
public void setBeginYear(int v)
-
getEndDay
public int getEndDay()
-
setEndDay
public void setEndDay(int v)
-
getEndMonth
public int getEndMonth()
-
setEndMonth
public void setEndMonth(int v)
-
getEndYear
public int getEndYear()
-
setEndYear
public void setEndYear(int v)
-
getDateType
public java.lang.String getDateType()
Retrieve the date type being used for date range search.- Returns:
- a value matching common date identifier. eg
cdate
(default type if empty or invalid),pdate
,mdate
,edate
, ...
-
setDateType
public void setDateType(java.lang.String type)
Set the date type being used for date range search.- Parameters:
type
- a value matching common date identifier. egcdate
(default type if empty or invalid),pdate
,mdate
,edate
, ...
-
setCatMode
public void setCatMode(java.lang.String v)
Define the mode to use when dealing with categories.You can specify any of the following value:
"or"
: Union of categories"and"
: Intersection of categories (default mode if empty or invalid)
- Parameters:
v
- "or" or "and"
-
getCatMode
public java.lang.String getCatMode()
Retrieve the mode to use when dealing with categories.- Returns:
"or"
for Union of categories,"and"
for Intersection of categories (default mode if empty or invalid).
-
getDateSinceInt
public int getDateSinceInt()
-
setDateSince
public void setDateSince(java.lang.String v)
-
setDateSince
public void setDateSince(int v)
-
getHist
public java.lang.String getHist()
-
setHist
public void setHist(java.lang.String v)
-
getHistLevel
public int getHistLevel()
-
setHistLevel
public void setHistLevel(int v)
-
getSort
public java.lang.String getSort()
-
setSort
public void setSort(java.lang.String sort)
-
getReverse
public boolean getReverse()
-
setReverse
public void setReverse(boolean v)
-
getTypes
public java.lang.String[] getTypes()
-
setTypes
public void setTypes(java.lang.String... types)
-
validateTypesArray
protected static java.lang.String[] validateTypesArray(java.lang.String[] types)
Validate the specified types array- Parameters:
types
-- Returns:
- a new array
-
getTypesOff
public java.lang.String[] getTypesOff()
-
setTypesOff
public void setTypesOff(java.lang.String... typesOff)
-
getExactType
public boolean getExactType()
-
setExactType
public void setExactType(boolean v)
-
getWfId
public java.lang.String getWfId()
-
setWfId
public void setWfId(java.lang.String wfId)
-
getPstatus
public java.lang.String[] getPstatus()
Retrieves the pstatus values to be searched by this query.This method returns the original value defined with the setter
setPstatus(String...)
, usegetIntPstatus()
to retrieve the resolved pstatus values as an int array.- Returns:
- an array of String, each string representing a pstatus value (int) to be searched for
- Since:
- jcms-2.1
- See Also:
getIntPstatus()
-
setPstatus
public void setPstatus(java.lang.String... pstatus)
Sets the pstatus values to be searched by this query.- Parameters:
pstatus
- an array of String, each string representing a pstatus value (int) to be searched for empty values in the array are ignored, if given array is null, pstatus search is reset.- Since:
- jcms-2.1
-
getIntPstatus
public int[] getIntPstatus()
Retrieves the current pstatus values to be searched by this query.- Returns:
- an array of int, each int is a pstatus value to be searched for
- Since:
- jcms-2.1
-
getCheckPstatus
public boolean getCheckPstatus()
-
setCheckPstatus
public void setCheckPstatus(boolean v)
-
setLangs
public void setLangs(java.lang.String... langArray)
The language(s) in which publications must have been translated to be part of the results.A publication is considered translated in a language according to rules defines by
Publication.checkLang(String)
, ie if the title or the abstract have been specified in the language.Default behavior is to search for all content, without restriction on the translated language.
Not to be confused with
setContentLangs(String...)
- Parameters:
langArray
- an array containing ISO-639 language code and/or"user"
value which is replaced with the current user lang as retieved bygetUserLang()
.
-
getLangs
public java.lang.String[] getLangs()
Retrieve the language in which publications must have been translated to be part of the results.If the
"user"
value was specified insetLangs(String...)
this method will return the user language resolved at the time of the setter invocation.- Returns:
- an array containing ISO-639 language code, null if default behavior was applied
-
getUnresolvedLangs
public java.lang.String[] getUnresolvedLangs()
Retrieve the language in which publications must have been translated to be part of the results.This method is said to return an "unresolved" language value because if the
"user"
value was specified insetLangs(String...)
it will be returned as is (contrary to methodgetLangs()
which return the user language resolved at the time of the setter invocation)- Returns:
- an array containing ISO-639 language code and/or
"user"
value, null if default behavior was applied
-
setContentLangs
public void setContentLangs(java.lang.String... langArray)
The language(s) in which text search will be performed, that is, the language(s) of the publications' fields values in which to search for the specified text.Default behavior is to search for the specified text in all language variation of the publications' fields.
If
"user"
is specified as a paramter value, it is replaced with the current user lang as retieved bygetUserLang()
ugetUserLang()).Not to be confused with
setLangs(String...)
- Parameters:
langArray
- an array containing ISO-639 language code and/or"user"
value which is replaced with the current user lang as retieved bygetUserLang()
.- Since:
- jcms-8.0.0
-
getContentLangs
public java.lang.String[] getContentLangs()
Retrieve the language in which text search is performed.If the
"user"
value was specified insetContentLangs(String...)
this method will return the user language resolved at the time of the setter invocation.Not to be confused with
getLangs()
- Returns:
- an array containing ISO-639 language code, null if default behavior was applied
- Since:
- jcms-8.0.0
-
getUnresolvedContentLangs
public java.lang.String[] getUnresolvedContentLangs()
Retrieve the language in which text search is performed.This method is said to return an "unresolved" language value because if the
"user"
value was specified insetContentLangs(String...)
it will be returned as is (contrary to methodgetContentLangs()
which return the user language resolved at the time of the setter invocation)Not to be confused with
getUnresolvedLangs()
- Returns:
- an array containing ISO-639 language code and/or
"user"
value, null if default behavior was applied - Since:
- jcms-8.0.0
-
getReplaceFileDoc
public boolean getReplaceFileDoc()
-
setReplaceFileDoc
public void setReplaceFileDoc(boolean v)
-
getSearchedFields
public java.lang.String[] getSearchedFields()
Retrieves the lucene fields in which the text search is being performed for publications.- Returns:
- an array of lucene field name in which to do the text search. (if null or empty default behavior is used)
-
setSearchedFields
public void setSearchedFields(java.lang.String... searchedFields)
Defines the (lucene) publications fields in which to perform the text search.- Parameters:
searchedFields
- an array of lucene field name in which to do the text search. if null or empty will use default behavior.
-
setAbility
public void setAbility(java.lang.String ability)
Sets the portal element's ability to match when PortalElement are found.- Parameters:
ability
- an ability choosen from values returned byPortalElement.getAllAbilities()
, or"noabilities"
for portlet without any ability, or"hasabilities"
for portlet with any ability.
-
getAbility
public java.lang.String getAbility()
Retrieves the current the portal element's ability defined for this QueryHandler.- Returns:
- the ability defined for this query.
-
getStart
public int getStart()
-
setStart
public void setStart(int start)
-
getPageSize
public int getPageSize()
-
setPageSize
public void setPageSize(int pageSize)
-
getPagerAll
public boolean getPagerAll()
-
setPagerAll
public void setPagerAll(boolean pagerAll)
-
getHistoryList
public java.util.List<java.lang.String> getHistoryList()
Not set : - before the query method has been called. - for internal queryHandlers used for refinement in QueryManager.query processing.- Returns:
- the list of the descriptions of the current query and the query recursively in "hist" request param.
-
setHistoryList
public void setHistoryList(java.util.List<java.lang.String> historyList)
Set the list of descriptions of the query and the query recursively in "hist" request param.- Parameters:
historyList
- the history list
-
setDocumentKinds
public void setDocumentKinds(java.lang.String... kinds)
Set the kind of document to match for this QueryHandler- Parameters:
kinds
- an array of document kind (e.g "pdf", "image", "spreadsheet", ...)- Since:
- jcms-6.1
-
getDocumentKinds
public java.lang.String[] getDocumentKinds()
Retrieve the kind of document defined for this QueryHandler- Returns:
- a set of content type, never return null
- Since:
- jcms-6.1
-
getAdvanced
public java.lang.String getAdvanced()
-
setAdvanced
public void setAdvanced(java.lang.String advanced)
-
appendAdvanced
public void appendAdvanced(java.lang.String key, java.lang.Object value)
-
appendAdvanced
public void appendAdvanced(java.lang.String key, java.lang.Object[] values)
-
getDocumentKindsGroupMap
public static java.util.Map<java.lang.String,java.lang.String> getDocumentKindsGroupMap(java.lang.String userLang)
Retrieve a map of all document kind group defined in properties.- Parameters:
userLang
- the ISO-639 language code in which to retrieve labels- Returns:
- a Map of group kind name (e.g. "office", "media", "misc") to document kind group label (e.g "Office documents", "Medias", "Other", ...)
- Since:
- jcms-6.1
-
getDocumentKindsMap
public static java.util.Map<java.lang.String,java.lang.String> getDocumentKindsMap(java.lang.String userLang, java.lang.String kindGroup)
Retrieve a map of all document kind for the specified kind group.- Parameters:
userLang
- the ISO-639 language code in which to retrieve labelskindGroup
- document kind group as retrieve in key of map returned bygetDocumentKindsGroupMap(String)
- Returns:
- a Map of kind name (e.g. "spreasheet", "wordprocessing", ...) to document kind label (e.g "Spreadsheet", "Word processing", ...)
- Since:
- jcms-6.1
-
getContentTypesFromDocumentKind
public static java.util.List<java.lang.String> getContentTypesFromDocumentKind(java.lang.String kind)
Retrieve the content type to use for the specified document kind- Parameters:
kind
- a document kind, as retrieved bygetDocumentKindsMap(String, String)
- Returns:
- an list of content types
- Since:
- jcms-6.1
-
isHybridSearch
public boolean isHybridSearch()
Returns true if this is an hybrid search (i.e. JStore and JcmsDB).- Returns:
- true if this is an hybrid search (i.e. JStore and JcmsDB).
- Since:
- jcms-6.2.0
-
getTypesCommonSuperClass
public static java.lang.Class<? extends Publication> getTypesCommonSuperClass(QueryHandler... queryHandlers)
Retrieve the common super class of types specified in the QueryHandler.Eg :
assertEquals(Publication.class, QueryHandler.getTypesCommonSuperClass((QueryHandler[]) null)); assertEquals(Article.class, QueryHandler.getTypesCommonSuperClass(new QueryHandler("types=Article"))); assertEquals(Content.class, QueryHandler.getTypesCommonSuperClass(new QueryHandler("types=Article&types=SmallNews"))); assertEquals(AbstractPortletSkinable.class, QueryHandler.getTypesCommonSuperClass(new QueryHandler("types=PortletJsp&types=PortletQueryForeachDetail"))); assertEquals(Publication.class, QueryHandler.getTypesCommonSuperClass(new QueryHandler("types=Article&types=PortletJsp")));
- Parameters:
queryHandlers
- one or several QueryHandler which will be used to extract the common super class of the specified types parameter- Returns:
- a Class, never return null (default to Publication.class in case class could not be found )
- Since:
- jcms-7.1.0
-
getQueryFilterContext
public java.util.Map<java.lang.String,java.lang.Object> getQueryFilterContext()
-
getSearchInTrash
public boolean getSearchInTrash()
Get option indicating if content in trash are included in result or not.Default is to exclude trashed publication from result.
- Returns:
- true if trashed publication will be included in result, false if they are excluded (default)
- Since:
- jcms-10.0.5 / JCMS-8353
-
setSearchInTrash
public void setSearchInTrash(boolean searchInTrash)
Set option indicating if content in trash are included in result or not.Default is to exclude trashed publication from result.
- Parameters:
searchInTrash
- true if trashed publication are to be included in result, false if they are to be excluded (default)- Since:
- jcms-10.0.5 / JCMS-8353
-
-