Class 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 or refine.jsp).
      The QueryHandler is instanciated with the request property which initializes the bean exactly like a JcmsJspContext instance, with all contextual informations (specially the logged member). Therefore the query will be performed using access right of the loggedMember 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 $
    • Field Detail

      • 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 new QueryHandler 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 new QueryHandler, 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, see setText(String)
        mode - the text search mode to use, see setMode(String)
        catName - whether to perform text search in categories, see setCatName(boolean)
        exactCat - whether to find publication only when they have one of the category to setCatName(boolean)
        searchInPub - whether to perform text search in publication, see setSearchInPub(boolean)
        searchInFile - whether to perform text search in files, see setSearchInFiles(boolean)
        cids - an array of Category's ids that publication must match to be found, see setCids(String...)
        cidsOff - an array of Category's ids that publication must NOT match to be found, see setCidsOff(String...)
        mids - an array of Member's ids defining the authors the publication must match to be found, see setMids(String...)
        midsOff - an array of Member's ids defining the authors the publication must NOT match to be found, see setMidsOff(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, see setGids(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, see setGidsOff(String...)
        beginDate - the begin date
        beginDay - the begin day
        beginMonth - the begin month
        beginYear - the begin year
        endDate - the end date
        endDay - the end day
        endMonth - the end month
        endYear - the end year
        dateType - the date type
        dateSince - the date since value
        types - an array of types that publication must match to be found
        typesOff - an array of types that publication must NOT match to be found
        exactType - search only for exact type (no sub types)
        pstatus - the pstatus searched
        checkPstatus - should the pstatus be checked
        langs - the languages
        replaceFileDoc - should the FileDocument be replaced by their refereres
      • QueryHandler

        public QueryHandler​(java.lang.String queryString)
        Constructs a new QueryHandler 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"
    • Method Detail

      • 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 class AbstractQueryHandler<Publication>
        Parameters:
        key - the parameter name, never null nor empty.
        values - the parameter values, NEVER NULL NOR EMPTY. You can safely invoke paramValues[0]
      • printParams

        protected java.lang.String printParams​(AbstractQueryHandler.QueryHandlerPrinter printer)
        Print current QueryHandler params using specified QueryHandlerPrinter.
        Specified by:
        printParams in class AbstractQueryHandler<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 class java.lang.Object
      • getResultSet

        public QueryResultSet getResultSet()
        Return results of a query done using this QueryHandler.

        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 a HashSet and therefore it is NOT sorted. use either getAsSortedSet() or getAsSortedSet(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
      • 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) and setWorkspaceSet(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)
      • 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 class JcmsContext
        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
      • 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() equals TEXT_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() equals TEXT_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() equals TEXT_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() equals TEXT_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 is null.

        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 is false.

        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 to false 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, see DateUtil.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, see DateUtil.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. eg cdate (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...), use getIntPstatus() 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 by getUserLang().
      • 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 in setLangs(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 in setLangs(String...) it will be returned as is (contrary to method getLangs() 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 by getUserLang() 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 by getUserLang().
        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 in setContentLangs(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 in setContentLangs(String...) it will be returned as is (contrary to method getContentLangs() 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 by PortalElement.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 labels
        kindGroup - document kind group as retrieve in key of map returned by getDocumentKindsGroupMap(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 by getDocumentKindsMap(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