Class SearchQueryUtil


  • public class SearchQueryUtil
    extends java.lang.Object
    Search query utilities.
    Since:
    8.1.0
    Version:
    $Revision: 26047 $ $Date: 2023-12-01 18:11:49 -0300 (Fri, 01 Dec 2023) $
    • Constructor Summary

      Constructors 
      Constructor Description
      SearchQueryUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<DocumentTypeField,​java.lang.Float> getFieldsBoost​(SessionConfig sessionConfig, java.lang.String serviceInstanceId, ITransaction transaction)
      Returns the fields boosts of the given service instance or null if the user is using the default configuration.
      static SearchQuery getSearchQuery​(java.lang.String userQuery, java.util.Map<DocumentTypeField,​java.lang.Float> fieldsBoost, ServiceInstanceConfig searchServiceInstanceConfig, java.util.Collection<java.lang.String> publishedContextIds, java.util.Collection<SearchQuerySort> sorts, int startAt, int maxRows, boolean includePublicationUrlExistFilter)
      Returns the search query using the given parameters.
      static SearchQuery getSearchQuery​(java.lang.String userQuery, java.util.Map<DocumentTypeField,​java.lang.Float> fieldsBoost, ServiceInstanceConfig searchServiceInstanceConfig, java.util.Collection<java.lang.String> publishedContextIds, java.util.Collection<SearchQuerySort> sorts, int startAt, int maxRows, boolean includePublicationUrlExistFilter, boolean forceIncludePublishedContexts)
      Returns the search query using the given parameters.
      static SearchQuery getSearchQuery​(java.lang.String userQuery, ServiceInstanceConfig searchServiceInstanceConfig, java.util.Collection<java.lang.String> publishedContextIds, java.util.Collection<SearchQuerySort> sorts, int startAt, int maxRows, boolean includePublicationUrlExistFilter)
      Returns the search query using the given parameters.
      static SearchQuery getSearchQuery​(java.lang.String userQuery, ServiceInstanceConfig searchServiceInstanceConfig, java.util.Collection<java.lang.String> publishedContextIds, java.util.Collection<SearchQuerySort> sorts, int startAt, int maxRows, boolean includePublicationUrlExistFilter, boolean forceIncludePublishedContexts)
      Returns the search query using the given parameters.
      static void setFieldsBoost​(SessionConfig sessionConfig, java.util.Map<DocumentTypeField,​java.lang.Float> boosts, java.lang.String serviceInstanceId, ITransaction transaction)
      Sets the given fields boosts in the given service instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SearchQueryUtil

        public SearchQueryUtil()
    • Method Detail

      • getSearchQuery

        public static SearchQuery getSearchQuery​(java.lang.String userQuery,
                                                 ServiceInstanceConfig searchServiceInstanceConfig,
                                                 java.util.Collection<java.lang.String> publishedContextIds,
                                                 java.util.Collection<SearchQuerySort> sorts,
                                                 int startAt,
                                                 int maxRows,
                                                 boolean includePublicationUrlExistFilter)
                                          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.
        includePublicationUrlExistFilter - indicates whether a filter must be included to search only for the publications with URL.
        Returns:
        the created search query.
        Throws:
        PortalException
        Since:
        14.2.0
      • getSearchQuery

        public static SearchQuery getSearchQuery​(java.lang.String userQuery,
                                                 java.util.Map<DocumentTypeField,​java.lang.Float> fieldsBoost,
                                                 ServiceInstanceConfig searchServiceInstanceConfig,
                                                 java.util.Collection<java.lang.String> publishedContextIds,
                                                 java.util.Collection<SearchQuerySort> sorts,
                                                 int startAt,
                                                 int maxRows,
                                                 boolean includePublicationUrlExistFilter)
                                          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.
        includePublicationUrlExistFilter - indicates whether a filter must be included to search only for the publications with URL.
        Returns:
        the created search query.
        Throws:
        PortalException
        Since:
        14.2.0
      • getSearchQuery

        public static SearchQuery getSearchQuery​(java.lang.String userQuery,
                                                 ServiceInstanceConfig searchServiceInstanceConfig,
                                                 java.util.Collection<java.lang.String> publishedContextIds,
                                                 java.util.Collection<SearchQuerySort> sorts,
                                                 int startAt,
                                                 int maxRows,
                                                 boolean includePublicationUrlExistFilter,
                                                 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.
        includePublicationUrlExistFilter - indicates whether a filter must be included to search only for the publications with URL.
        forceIncludePublishedContexts -
        Returns:
        the created search query.
        Throws:
        PortalException
        Since:
        14.2.0
      • getSearchQuery

        public static SearchQuery getSearchQuery​(java.lang.String userQuery,
                                                 java.util.Map<DocumentTypeField,​java.lang.Float> fieldsBoost,
                                                 ServiceInstanceConfig searchServiceInstanceConfig,
                                                 java.util.Collection<java.lang.String> publishedContextIds,
                                                 java.util.Collection<SearchQuerySort> sorts,
                                                 int startAt,
                                                 int maxRows,
                                                 boolean includePublicationUrlExistFilter,
                                                 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.
        includePublicationUrlExistFilter - indicates whether a filter must be included to search only for the publications with URL.
        forceIncludePublishedContexts -
        Returns:
        the created search query.
        Throws:
        PortalException
        Since:
        14.2.0
      • getFieldsBoost

        public static java.util.Map<DocumentTypeField,​java.lang.Float> getFieldsBoost​(SessionConfig sessionConfig,
                                                                                            java.lang.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,
                                          java.util.Map<DocumentTypeField,​java.lang.Float> boosts,
                                          java.lang.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