Class SearchManagerServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.services.SearchManagerServiceImpl
-
- All Implemented Interfaces:
SearchManagerService
@Service public class SearchManagerServiceImpl extends java.lang.Object implements SearchManagerService
-
-
Field Summary
Fields Modifier and Type Field Description private AccessManagementService
accessManagementService
private co.mastermindcms.ai.gpt.config.AiConfiguration
aiConfiguration
private co.mastermindcms.ai.gpt.services.ChatGPTService
chatGPTService
private CommerceProperties
commerceProperties
private CommonProperties
commonProperties
private LanguageRepository
languageRepository
private static com.fasterxml.jackson.databind.ObjectMapper
mapper
private org.springframework.data.mongodb.core.MongoTemplate
mongoTemplate
private java.util.Map<java.lang.String,java.lang.Object>
searchContext
private WebSiteSettingsRepository
settingsRepository
private TranslationService
translationService
-
Constructor Summary
Constructors Constructor Description 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 filtersjava.util.List<co.mastermindcms.modules.beans.GroupFilter>
listFilterValues(java.lang.String filterId)
This method collects all values from filterco.mastermindcms.modules.beans.GroupFilter
listingFeatureFromAttribute(java.lang.String filterId, java.lang.String sellerSkuId)
This method retrieves a feature for specific listingjava.util.List<co.mastermindcms.modules.beans.GroupFilter>
logicalFilters()
This method collects all the boolean filtersjava.util.List<co.mastermindcms.modules.beans.GroupFilter>
numericFilters()
This method collects all the numeric filtersjava.util.List<co.mastermindcms.modules.beans.GroupFilter>
numericFilterValues(java.lang.String filterId)
This method collects all values from filterjava.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 filtersjava.util.List<co.mastermindcms.modules.beans.GroupFilter>
rangeFilterValues(java.lang.String filterId)
This method collects all values from filterco.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 filtersjava.util.List<co.mastermindcms.modules.beans.GroupFilter>
simpleFilterValues(java.lang.String filterId)
This method collects all values from filter
-
-
-
Field Detail
-
mongoTemplate
@Autowired private org.springframework.data.mongodb.core.MongoTemplate mongoTemplate
-
settingsRepository
@Autowired private WebSiteSettingsRepository settingsRepository
-
languageRepository
@Autowired private LanguageRepository languageRepository
-
accessManagementService
@Autowired private AccessManagementService accessManagementService
-
translationService
@Autowired private TranslationService translationService
-
chatGPTService
@Autowired private co.mastermindcms.ai.gpt.services.ChatGPTService chatGPTService
-
aiConfiguration
@Autowired private co.mastermindcms.ai.gpt.config.AiConfiguration aiConfiguration
-
commerceProperties
@Autowired private CommerceProperties commerceProperties
-
commonProperties
@Autowired private CommonProperties commonProperties
-
searchContext
private final java.util.Map<java.lang.String,java.lang.Object> searchContext
-
mapper
private static final com.fasterxml.jackson.databind.ObjectMapper mapper
-
-
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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- Parameters:
filterId
- the ID of the filter to retrieve values fortype
- 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 interfaceSearchManagerService
- Parameters:
filterId
- filter identifiersellerSkuId
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- 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 interfaceSearchManagerService
- Parameters:
request
- the search request containing filter options- Returns:
- a filtered query definition
-
-