Class DefaultFlexibleSearchService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService
-
- All Implemented Interfaces:
FlexibleSearchService,java.io.Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
public class DefaultFlexibleSearchService extends AbstractBusinessService implements FlexibleSearchService
Default implementation of the flexible search service.- Since:
- 4.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManager
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant
-
-
Constructor Summary
Constructors Constructor Description DefaultFlexibleSearchService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> SearchResultImpl<T>createEmptyResult(SearchResult<T> jaloResult)ConverterRegistrygetConverterRegistry()protected FlexibleSearchgetFlexibleSearchInstance()<T> TgetModelByExample(T example)Search for an existing object (in the database) by a given (not saved) example.protected ModelConvertergetModelConverterByModel(java.lang.Object model)<T> java.util.List<T>getModelsByExample(T example)Search for an existing objects (in the database) by a given (not saved) example.ModelSearchStrategygetModelSearchStrategy()QueryPreprocessorRegistrygetQueryPreprocessorRegistry()protected java.lang.StringgetSourceTypeFromModel(java.lang.Object model)ConverterRegistrylookupConverterRegistry()Must be overwritten! Use <lookup-method> in spring.ModelSearchStrategylookupModelSearchStrategy()Must be overwritten! Use <lookup-method> in spring.QueryPreprocessorRegistrylookupQueryPreprocessorRegistry()<T> SearchResult<T>search(FlexibleSearchQuery query)Search.<T> SearchResult<T>search(java.lang.String query)Simplest search available.<T> SearchResult<T>search(java.lang.String query, java.util.Map<java.lang.String,? extends java.lang.Object> queryParams)Convenience method which internally delegates toFlexibleSearchService.search(FlexibleSearchQuery).<T> SearchResult<T>searchRelation(ItemModel model, java.lang.String attribute, int start, int count)This method is not implemented.<T> SearchResult<T>searchRelation(RelationQuery query)This method is not implemented.<T> TsearchUnique(FlexibleSearchQuery searchQuery)Searches for exactly one model fitting givenFlexibleSearchQuery.voidsetModelResolver(ItemObjectResolver modelResolver)voidsetMultiModelResolver(ItemObjectResolver multiModelResolver)<T> TtoPersistenceLayer(java.lang.Object modelValue)TranslationResulttranslate(FlexibleSearchQuery query)TranslatesFlexibleSearchQueryintoTranslationResultobject which contains translatedFlexibleSearchQueryto real SQL query and all parameters which will be used in SQL query.-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManager
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
-
-
-
Method Detail
-
getConverterRegistry
public ConverterRegistry getConverterRegistry()
-
getModelByExample
public <T> T getModelByExample(T example)
Description copied from interface:FlexibleSearchServiceSearch for an existing object (in the database) by a given (not saved) example. Every modified attribute in this example is used as search parameter.- Specified by:
getModelByExamplein interfaceFlexibleSearchService- Type Parameters:
T- the type of the example and the return type- Parameters:
example- the example- Returns:
- the result if this was found by the example.
-
getModelsByExample
public <T> java.util.List<T> getModelsByExample(T example)
Description copied from interface:FlexibleSearchServiceSearch for an existing objects (in the database) by a given (not saved) example. Every modified attribute in this example is used as search parameter. Returns all matching results.- Specified by:
getModelsByExamplein interfaceFlexibleSearchService- Type Parameters:
T- the type of the example and the return type- Parameters:
example- the example- Returns:
- the list of models found by the example.
-
getModelSearchStrategy
public ModelSearchStrategy getModelSearchStrategy()
-
getQueryPreprocessorRegistry
public QueryPreprocessorRegistry getQueryPreprocessorRegistry()
-
lookupConverterRegistry
public ConverterRegistry lookupConverterRegistry()
Must be overwritten! Use <lookup-method> in spring.
-
lookupModelSearchStrategy
public ModelSearchStrategy lookupModelSearchStrategy()
Must be overwritten! Use <lookup-method> in spring.
-
lookupQueryPreprocessorRegistry
public QueryPreprocessorRegistry lookupQueryPreprocessorRegistry()
-
search
public <T> SearchResult<T> search(FlexibleSearchQuery query)
Search.- Specified by:
searchin interfaceFlexibleSearchService- Parameters:
query- the search query- Returns:
- the search result< t>
-
createEmptyResult
protected <T> SearchResultImpl<T> createEmptyResult(SearchResult<T> jaloResult)
-
search
public <T> SearchResult<T> search(java.lang.String query)
Simplest search available.- Specified by:
searchin interfaceFlexibleSearchService- Parameters:
query- the query- Returns:
- the search result< t>
-
search
public <T> SearchResult<T> search(java.lang.String query, java.util.Map<java.lang.String,? extends java.lang.Object> queryParams)
Convenience method which internally delegates toFlexibleSearchService.search(FlexibleSearchQuery).- Specified by:
searchin interfaceFlexibleSearchService- Parameters:
query- query string in flexible search syntaxqueryParams- additional query parameters; null permitted- Returns:
- the search result< t>
-
searchRelation
public <T> SearchResult<T> searchRelation(ItemModel model, java.lang.String attribute, int start, int count)
This method is not implemented.- Specified by:
searchRelationin interfaceFlexibleSearchService
-
searchRelation
public <T> SearchResult<T> searchRelation(RelationQuery query)
This method is not implemented.- Specified by:
searchRelationin interfaceFlexibleSearchService
-
searchUnique
public <T> T searchUnique(FlexibleSearchQuery searchQuery)
Searches for exactly one model fitting givenFlexibleSearchQuery. Throws an exception when more or none results found.- Specified by:
searchUniquein interfaceFlexibleSearchService- Parameters:
searchQuery- the search query- Returns:
- the search result< t>
-
setModelResolver
public void setModelResolver(ItemObjectResolver modelResolver)
-
setMultiModelResolver
public void setMultiModelResolver(ItemObjectResolver multiModelResolver)
-
translate
public TranslationResult translate(FlexibleSearchQuery query)
Translates
FlexibleSearchQueryintoTranslationResultobject which contains translatedFlexibleSearchQueryto real SQL query and all parameters which will be used in SQL query.Translation also respects
SearchRestrictionModelbased restrictions for types and users.- Specified by:
translatein interfaceFlexibleSearchService- Parameters:
query-FlexibleSearchQueryto be translated.- Returns:
TranslationResultobject containing SQL query with parameters.
-
getModelConverterByModel
protected ModelConverter getModelConverterByModel(java.lang.Object model)
-
getSourceTypeFromModel
protected java.lang.String getSourceTypeFromModel(java.lang.Object model)
-
getFlexibleSearchInstance
protected FlexibleSearch getFlexibleSearchInstance()
-
toPersistenceLayer
public <T> T toPersistenceLayer(java.lang.Object modelValue)
-
-