Class SearchQueryUtil


  • public class SearchQueryUtil
    extends Object
    Search query utilities.
    Since:
    8.1.0
    Version:
    $Revision: 22372 $ $Date: 2019-02-06 19:01:54 -0200 (Wed, 06 Feb 2019) $
    • Constructor Detail

      • SearchQueryUtil

        public SearchQueryUtil()
    • Method Detail

      • getSearchQuery

        public static SearchQuery getSearchQuery​(String userQuery,
                                                 ServiceInstanceConfig searchServiceInstanceConfig,
                                                 Collection<String> publishedContextIds,
                                                 Collection<SearchQuerySort> sorts,
                                                 int startAt,
                                                 int maxRows)
                                          throws PortalException
        Returns the search query using the given parameters.
        Parameters:
        userQuery - the user query.
        searchServiceInstanceConfig - the search service instance.
        publishedContextIds - the search context identifiers.
        sorts - the sorting.
        startAt - the start at.
        maxRows - the max rows.
        Returns:
        the created search query.
        Throws:
        PortalException
        Since:
        8.1.0
      • getSearchQuery

        public static SearchQuery getSearchQuery​(String userQuery,
                                                 Map<DocumentTypeField,​Float> fieldsBoost,
                                                 ServiceInstanceConfig searchServiceInstanceConfig,
                                                 Collection<String> publishedContextIds,
                                                 Collection<SearchQuerySort> sorts,
                                                 int startAt,
                                                 int maxRows)
                                          throws PortalException
        Returns the search query using the given parameters.
        Parameters:
        userQuery - the user query.
        fieldsBoost - the field boost configuration, if any.
        searchServiceInstanceConfig - the search service instance.
        publishedContextIds - the search context identifiers.
        sorts - the sorting.
        startAt - the start at.
        maxRows - the max rows.
        Returns:
        the created search query.
        Throws:
        PortalException
        Since:
        11.1.0
      • getSearchQuery

        public static SearchQuery getSearchQuery​(String userQuery,
                                                 ServiceInstanceConfig searchServiceInstanceConfig,
                                                 Collection<String> publishedContextIds,
                                                 Collection<SearchQuerySort> sorts,
                                                 int startAt,
                                                 int maxRows,
                                                 boolean forceIncludePublishedContexts)
                                          throws PortalException
        Returns the search query using the given parameters.
        Parameters:
        userQuery - the user query.
        searchServiceInstanceConfig - the search service instance.
        publishedContextIds - the search context identifiers.
        sorts - the sorting.
        startAt - the start at.
        maxRows - the max rows.
        Returns:
        the created search query.
        Throws:
        PortalException
        Since:
        8.1.0
      • getSearchQuery

        public static SearchQuery getSearchQuery​(String userQuery,
                                                 Map<DocumentTypeField,​Float> fieldsBoost,
                                                 ServiceInstanceConfig searchServiceInstanceConfig,
                                                 Collection<String> publishedContextIds,
                                                 Collection<SearchQuerySort> sorts,
                                                 int startAt,
                                                 int maxRows,
                                                 boolean forceIncludePublishedContexts)
                                          throws PortalException
        Returns the search query using the given parameters.
        Parameters:
        userQuery - the user query.
        fieldsBoost - the field boost configuration, if any.
        searchServiceInstanceConfig - the search service instance.
        publishedContextIds - the search context identifiers.
        sorts - the sorting.
        startAt - the start at.
        maxRows - the max rows.
        Returns:
        the created search query.
        Throws:
        PortalException
        Since:
        11.1.0
      • getFieldsBoost

        public static Map<DocumentTypeField,​Float> getFieldsBoost​(SessionConfig sessionConfig,
                                                                        String serviceInstanceId,
                                                                        ITransaction transaction)
                                                                 throws PortalException
        Returns the fields boosts of the given service instance or null if the user is using the default configuration.
        Parameters:
        sessionConfig - the user's session.
        serviceInstanceId - the service instance identifier.
        transaction - the transaction.
        Returns:
        the fields boosts of the given service instance or null if the user is using the default configuration.
        Throws:
        PortalException
        Since:
        11.1.0
      • setFieldsBoost

        public static void setFieldsBoost​(SessionConfig sessionConfig,
                                          Map<DocumentTypeField,​Float> boosts,
                                          String serviceInstanceId,
                                          ITransaction transaction)
                                   throws PortalException
        Sets the given fields boosts in the given service instance. If the parameter boosts is null, than the configuration will be removed.
        Parameters:
        sessionConfig - the user's session.
        boosts - the boosts.
        serviceInstanceId - the service instance identifier.
        transaction - the transaction.
        Throws:
        PortalException
        Since:
        11.1.0