Class SearchManagerServiceImpl

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean aiSearchIsActive()
      Checks if the AI search functionality is currently active.
      java.util.List<java.lang.String> aiSearchKeywords​(java.lang.String query)
      Searches for keywords related to the provided query using AI.
      java.lang.String applyFilters​(co.mastermindcms.modules.beans.SearchRequest request)
      Applies filters to a search request and returns a filtered query definition.
      long countAll​(co.mastermindcms.modules.beans.SearchRequest request)
      Counts the total number of items that match the given search request.
      long countAll​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> requestAsMap)
      Counts the total number of items that match the given search request.
      java.lang.String[] doProcessSearchTerms​(java.lang.String searchTerms)
      Processes the provided search terms by performing a specific action.
      java.util.List<co.mastermindcms.modules.beans.GroupFilter> fieldFilterValues​(java.lang.String filterId, java.lang.String type)
      Retrieves a list of group filters based on the provided filter ID.
      java.util.List<co.mastermindcms.modules.beans.GroupFilter> listFilters()
      This method collects all the list filters
      java.util.List<co.mastermindcms.modules.beans.GroupFilter> listFilterValues​(java.lang.String filterId)
      This method collects all values from filter
      co.mastermindcms.modules.beans.GroupFilter listingFeatureFromAttribute​(java.lang.String filterId, java.lang.String sellerSkuId)
      This method retrieves a feature for specific listing
      java.util.List<co.mastermindcms.modules.beans.GroupFilter> logicalFilters()
      This method collects all the boolean filters
      java.util.List<co.mastermindcms.modules.beans.GroupFilter> numericFilters()
      This method collects all the numeric filters
      java.util.List<co.mastermindcms.modules.beans.GroupFilter> numericFilterValues​(java.lang.String filterId)
      This method collects all values from filter
      java.util.List<java.lang.String> parseSearchQuery​(java.lang.String query)
      Parses the search query to extract individual search terms.
      java.util.List<co.mastermindcms.modules.beans.GroupFilter> rangeFilters()
      This method collects all the range filters
      java.util.List<co.mastermindcms.modules.beans.GroupFilter> rangeFilterValues​(java.lang.String filterId)
      This method collects all values from filter
      co.mastermindcms.modules.beans.SearchResponse search​(co.mastermindcms.modules.beans.SearchRequest request)
      This method does search requests and returns data as pages.
      co.mastermindcms.modules.beans.SearchResponse search​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> requestAsMap)
      This method does search requests and returns data as pages.
      private co.mastermindcms.modules.beans.SearchResponse searchFull​(co.mastermindcms.modules.beans.SearchRequest request)  
      private co.mastermindcms.modules.beans.SearchResponse searchLimited​(co.mastermindcms.modules.beans.SearchRequest request)  
      java.util.List<co.mastermindcms.modules.beans.GroupFilter> simpleFilters()
      This method collects all the simple filters
      java.util.List<co.mastermindcms.modules.beans.GroupFilter> simpleFilterValues​(java.lang.String filterId)
      This method collects all values from filter
      • Methods inherited from class java.lang.Object

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

      • mongoTemplate

        @Autowired
        private org.springframework.data.mongodb.core.MongoTemplate mongoTemplate
      • chatGPTService

        @Autowired
        private co.mastermindcms.ai.gpt.services.ChatGPTService chatGPTService
      • aiConfiguration

        @Autowired
        private co.mastermindcms.ai.gpt.config.AiConfiguration aiConfiguration
      • searchContext

        private final java.util.Map<java.lang.String,​java.lang.Object> searchContext
      • mapper

        private static final com.fasterxml.jackson.databind.ObjectMapper mapper
    • Constructor Detail

      • SearchManagerServiceImpl

        public SearchManagerServiceImpl()
    • Method Detail

      • search

        public co.mastermindcms.modules.beans.SearchResponse search​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> requestAsMap)
        Description copied from interface: SearchManagerService
        This method does search requests and returns data as pages.
        Specified by:
        search in interface SearchManagerService
        Parameters:
        requestAsMap - search request as map
        Returns:
        database entities separated to pages
      • search

        public co.mastermindcms.modules.beans.SearchResponse search​(co.mastermindcms.modules.beans.SearchRequest request)
        Description copied from interface: SearchManagerService
        This method does search requests and returns data as pages.
        Specified by:
        search in interface SearchManagerService
        Parameters:
        request - search request as entity
        Returns:
        database entities separated to pages
      • countAll

        public long countAll​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> requestAsMap)
        Description copied from interface: SearchManagerService
        Counts the total number of items that match the given search request.
        Specified by:
        countAll in interface SearchManagerService
        Parameters:
        requestAsMap - search request as map
        Returns:
        the total number of items that match the search request
      • countAll

        public long countAll​(co.mastermindcms.modules.beans.SearchRequest request)
        Description copied from interface: SearchManagerService
        Counts the total number of items that match the given search request.
        Specified by:
        countAll in interface SearchManagerService
        Parameters:
        request - the search request containing the criteria for the search
        Returns:
        the total number of items that match the search request
      • logicalFilters

        public java.util.List<co.mastermindcms.modules.beans.GroupFilter> logicalFilters()
        Description copied from interface: SearchManagerService
        This method collects all the boolean filters
        Specified by:
        logicalFilters in interface SearchManagerService
        Returns:
        the collection of all logical filters
      • rangeFilters

        public java.util.List<co.mastermindcms.modules.beans.GroupFilter> rangeFilters()
        Description copied from interface: SearchManagerService
        This method collects all the range filters
        Specified by:
        rangeFilters in interface SearchManagerService
        Returns:
        the collection of all range filters
      • simpleFilters

        public java.util.List<co.mastermindcms.modules.beans.GroupFilter> simpleFilters()
        Description copied from interface: SearchManagerService
        This method collects all the simple filters
        Specified by:
        simpleFilters in interface SearchManagerService
        Returns:
        the collection of all simple filters
      • numericFilters

        public java.util.List<co.mastermindcms.modules.beans.GroupFilter> numericFilters()
        Description copied from interface: SearchManagerService
        This method collects all the numeric filters
        Specified by:
        numericFilters in interface SearchManagerService
        Returns:
        the collection of all numeric filters
      • listFilters

        public java.util.List<co.mastermindcms.modules.beans.GroupFilter> listFilters()
        Description copied from interface: SearchManagerService
        This method collects all the list filters
        Specified by:
        listFilters in interface SearchManagerService
        Returns:
        the collection of all list filters
      • rangeFilterValues

        public java.util.List<co.mastermindcms.modules.beans.GroupFilter> rangeFilterValues​(java.lang.String filterId)
        Description copied from interface: SearchManagerService
        This method collects all values from filter
        Specified by:
        rangeFilterValues in interface SearchManagerService
        Parameters:
        filterId - filter object identifier
        Returns:
        the list of all filter values
      • listFilterValues

        public java.util.List<co.mastermindcms.modules.beans.GroupFilter> listFilterValues​(java.lang.String filterId)
        Description copied from interface: SearchManagerService
        This method collects all values from filter
        Specified by:
        listFilterValues in interface SearchManagerService
        Parameters:
        filterId - filter object identifier
        Returns:
        the list of all filter values
      • simpleFilterValues

        public java.util.List<co.mastermindcms.modules.beans.GroupFilter> simpleFilterValues​(java.lang.String filterId)
        Description copied from interface: SearchManagerService
        This method collects all values from filter
        Specified by:
        simpleFilterValues in interface SearchManagerService
        Parameters:
        filterId - filter object identifier
        Returns:
        the list of all filter values
      • numericFilterValues

        public java.util.List<co.mastermindcms.modules.beans.GroupFilter> numericFilterValues​(java.lang.String filterId)
        Description copied from interface: SearchManagerService
        This method collects all values from filter
        Specified by:
        numericFilterValues in interface SearchManagerService
        Parameters:
        filterId - filter object identifier
        Returns:
        the list of all filter values
      • fieldFilterValues

        public java.util.List<co.mastermindcms.modules.beans.GroupFilter> fieldFilterValues​(java.lang.String filterId,
                                                                                            java.lang.String type)
        Description copied from interface: SearchManagerService
        Retrieves a list of group filters based on the provided filter ID.
        Specified by:
        fieldFilterValues in interface SearchManagerService
        Parameters:
        filterId - the ID of the filter to retrieve values for
        type - type of the entity
        Returns:
        a list of GroupFilter objects containing the filter values
      • listingFeatureFromAttribute

        public co.mastermindcms.modules.beans.GroupFilter listingFeatureFromAttribute​(java.lang.String filterId,
                                                                                      java.lang.String sellerSkuId)
        Description copied from interface: SearchManagerService
        This method retrieves a feature for specific listing
        Specified by:
        listingFeatureFromAttribute in interface SearchManagerService
        Parameters:
        filterId - filter identifier
        sellerSkuId - listing identifier
        Returns:
        the value of listing feature
      • searchFull

        private co.mastermindcms.modules.beans.SearchResponse searchFull​(co.mastermindcms.modules.beans.SearchRequest request)
      • searchLimited

        private co.mastermindcms.modules.beans.SearchResponse searchLimited​(co.mastermindcms.modules.beans.SearchRequest request)
      • doProcessSearchTerms

        public java.lang.String[] doProcessSearchTerms​(java.lang.String searchTerms)
        Description copied from interface: SearchManagerService
        Processes the provided search terms by performing a specific action.
        Specified by:
        doProcessSearchTerms in interface SearchManagerService
        Parameters:
        searchTerms - An array of search terms to be processed
        Returns:
        A modified array of search terms after processing
      • aiSearchKeywords

        public java.util.List<java.lang.String> aiSearchKeywords​(java.lang.String query)
        Description copied from interface: SearchManagerService
        Searches for keywords related to the provided query using AI.
        Specified by:
        aiSearchKeywords in interface SearchManagerService
        Parameters:
        query - The search query for which keywords are to be searched
        Returns:
        A list of keywords related to the query
      • aiSearchIsActive

        public boolean aiSearchIsActive()
        Description copied from interface: SearchManagerService
        Checks if the AI search functionality is currently active.
        Specified by:
        aiSearchIsActive in interface SearchManagerService
        Returns:
        True if AI search is active, false otherwise
      • parseSearchQuery

        public java.util.List<java.lang.String> parseSearchQuery​(java.lang.String query)
        Description copied from interface: SearchManagerService
        Parses the search query to extract individual search terms.
        Specified by:
        parseSearchQuery in interface SearchManagerService
        Parameters:
        query - The search query to be parsed
        Returns:
        A list of individual search terms extracted from the query
      • applyFilters

        public java.lang.String applyFilters​(co.mastermindcms.modules.beans.SearchRequest request)
        Description copied from interface: SearchManagerService
        Applies filters to a search request and returns a filtered query definition.
        Specified by:
        applyFilters in interface SearchManagerService
        Parameters:
        request - the search request containing filter options
        Returns:
        a filtered query definition