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 AccessManagementServiceaccessManagementServiceprivate co.mastermindcms.ai.gpt.config.AiConfigurationaiConfigurationprivate co.mastermindcms.ai.gpt.services.ChatGPTServicechatGPTServiceprivate CommercePropertiescommercePropertiesprivate CommonPropertiescommonPropertiesprivate LanguageRepositorylanguageRepositoryprivate static com.fasterxml.jackson.databind.ObjectMappermapperprivate org.springframework.data.mongodb.core.MongoTemplatemongoTemplateprivate java.util.Map<java.lang.String,java.lang.Object>searchContextprivate WebSiteSettingsRepositorysettingsRepositoryprivate TranslationServicetranslationService
-
Constructor Summary
Constructors Constructor Description SearchManagerServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaiSearchIsActive()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.StringapplyFilters(co.mastermindcms.modules.beans.SearchRequest request)Applies filters to a search request and returns a filtered query definition.longcountAll(co.mastermindcms.modules.beans.SearchRequest request)Counts the total number of items that match the given search request.longcountAll(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.GroupFilterlistingFeatureFromAttribute(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.SearchResponsesearch(co.mastermindcms.modules.beans.SearchRequest request)This method does search requests and returns data as pages.co.mastermindcms.modules.beans.SearchResponsesearch(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.SearchResponsesearchFull(co.mastermindcms.modules.beans.SearchRequest request)private co.mastermindcms.modules.beans.SearchResponsesearchLimited(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:SearchManagerServiceThis method does search requests and returns data as pages.- Specified by:
searchin 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:SearchManagerServiceThis method does search requests and returns data as pages.- Specified by:
searchin 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:SearchManagerServiceCounts the total number of items that match the given search request.- Specified by:
countAllin 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:SearchManagerServiceCounts the total number of items that match the given search request.- Specified by:
countAllin 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:SearchManagerServiceThis method collects all the boolean filters- Specified by:
logicalFiltersin interfaceSearchManagerService- Returns:
- the collection of all logical filters
-
rangeFilters
public java.util.List<co.mastermindcms.modules.beans.GroupFilter> rangeFilters()
Description copied from interface:SearchManagerServiceThis method collects all the range filters- Specified by:
rangeFiltersin interfaceSearchManagerService- Returns:
- the collection of all range filters
-
simpleFilters
public java.util.List<co.mastermindcms.modules.beans.GroupFilter> simpleFilters()
Description copied from interface:SearchManagerServiceThis method collects all the simple filters- Specified by:
simpleFiltersin interfaceSearchManagerService- Returns:
- the collection of all simple filters
-
numericFilters
public java.util.List<co.mastermindcms.modules.beans.GroupFilter> numericFilters()
Description copied from interface:SearchManagerServiceThis method collects all the numeric filters- Specified by:
numericFiltersin interfaceSearchManagerService- Returns:
- the collection of all numeric filters
-
listFilters
public java.util.List<co.mastermindcms.modules.beans.GroupFilter> listFilters()
Description copied from interface:SearchManagerServiceThis method collects all the list filters- Specified by:
listFiltersin 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:SearchManagerServiceThis method collects all values from filter- Specified by:
rangeFilterValuesin 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:SearchManagerServiceThis method collects all values from filter- Specified by:
listFilterValuesin 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:SearchManagerServiceThis method collects all values from filter- Specified by:
simpleFilterValuesin 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:SearchManagerServiceThis method collects all values from filter- Specified by:
numericFilterValuesin 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:SearchManagerServiceRetrieves a list of group filters based on the provided filter ID.- Specified by:
fieldFilterValuesin 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:SearchManagerServiceThis method retrieves a feature for specific listing- Specified by:
listingFeatureFromAttributein 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:SearchManagerServiceProcesses the provided search terms by performing a specific action.- Specified by:
doProcessSearchTermsin 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:SearchManagerServiceSearches for keywords related to the provided query using AI.- Specified by:
aiSearchKeywordsin 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:SearchManagerServiceChecks if the AI search functionality is currently active.- Specified by:
aiSearchIsActivein 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:SearchManagerServiceParses the search query to extract individual search terms.- Specified by:
parseSearchQueryin 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:SearchManagerServiceApplies filters to a search request and returns a filtered query definition.- Specified by:
applyFiltersin interfaceSearchManagerService- Parameters:
request- the search request containing filter options- Returns:
- a filtered query definition
-
-