FlexibleSearchService and
SearchRestrictionService instead.@Deprecated public class FlexibleSearch extends Manager
An overview on the FlexibleSearch syntax:
<query> = "SELECT" <selects> "FROM" <types> ( "WHERE" <conditions> ( "ORDER BY" <order> )? )?
<selects> = SQL <i>select</i> expression that contains attribute <field> sections
<types> = SQL <i>from</i> expression that contains item <type> and <typejoin> sections
<type> = "{" <single-type-clause> "}"
<typejoin> = "{" <single-type-clause> ( ( "LEFT" )? "JOIN" <single-type-clause> ( "ON" <join-conditions> )? )+ "}"
<single-type-clause> = code of type "!"? ( "AS" <type-alias> )? <type-modifiers>?
<type-alias> = a unique name of this type inside this query
<join-conditions> = SQL boolean condition including <field> sections ( "AND" SQL boolean condition including <field> sections )*
<conditions> = SQL <i>where</i> expression containing attribute <field> sections and <subselect> sections
<order> = SQL <i>order by </i> expression containing attribute <field> sections
<field> = "{" ( <type-alias> ":" )? <attribute-name> <language>( ":" <modifiers> )? "}"
<attribute-name> = the attribute name
<language> = "[" language PK string + "]"
<modifiers> = ( "c" | "l")? "o"? ... core field , localized property, outer joined property
<subselect> = "{{" <query> "}}"
A simple select to find all items of one type can be done like this:
ComposedType unitType = jaloSession.getTypeManager().getComposedType(Unit.class);
String query = "SELECT {" + Item.PK + "} FROM {" + unitType.getCode() + "}";
List units = jaloSession.getFlexibleSearch().search(query, // the query text
Collections.EMPTY_MAP, // no values needed here
Collections.singletonList(Unit.class), // the expected result (row) signature
true, // fail on unknown (untyped) fields
true, // don't need total
0, -1 // result range start = 0, count = -1 (unlimited)
).getResult();
Please note that items are always referenced as "{" + Item.PK + "}" . The actual item type is defined by
the search result signature list, e.g. Collections.singletonList(Item.class).
If you know that a search query is likely to yield a lot of results (such as a search for all products and their variants, for example), we discourage getting all of those search results in a single FlexibleSearch call: the results will be stored in a single Collection, which may result in slow performance. A better way is to split the query into several calls by limiting the number of search results per call, as in the following code snippet:
ComposedType unitType = jaloSession.getTypeManager().getComposedType(Unit.class);
String query = "SELECT {" + Item.PK + "} FROM {" + unitType.getCode() + "}";
int start = 0;
final int range = 3;
int total = -1;
do
{
SearchResult res = jaloSession.getFlexibleSearch().search(query, // the query text
Collections.EMPTY_MAP, // no values needed here
Collections.singletonList(Unit.class), // the expected result (row) signature
true, // fail on unknown (untyped) fields
false, // disable 'don't need total' here !
start, range // result range start = 0, count = -1 (unlimited)
);
List unitRange = res.getResult();
//
// process result
//
total = res.getTotalCount();
start += range;
}
while (start < total);
If you run such an iterated statement, you need to set the dontNeedTotal parameter to false.Unlike EJB finders, the FlexibleSearch is able of retrieving raw data as well as items. Furthermore, it is possible to select multiple attributes or columns. the result of multi-attribute selections is a list of lists.
ComposedType unitType = jaloSession.getTypeManager().getComposedType(Unit.class);
String query =
// select
"SELECT {" + Item.PK + "} " + // the unit itself
",LOWER({" + Unit.CODE + "})" + // get the code cmp field
",{" + Unit.NAME + "}" + // get the localized name
// from
"FROM {" + unitType.getCode() + "}";
List rows = jaloSession.getFlexibleSearch().search(query, // the query text
Collections.EMPTY_MAP, // no values needed here
Arrays.asList(new Class[]
{ Unit.class, String.class, String.class }), // the expected result row signature: Unit, String, String
true, // fail on unknown (untyped) fields
true, // don't need total
0, -1 // result range start = 0, count = -1 (unlimited)
).getResult();
for (int i = 0, s = rows.size(); i < s; i++)
{
List row = (List) rows.get(i);
Unit u = row.get(0);
String codeLowerCase = row.get(1);
String name = row.get(2);
// ...
}
As seen here it is possible to use any column based SQL functions around flexible search sections (
"LOWER({"+Unit.CODE+"}" ) since only these sections are replaced. the rest of the query is left
untouched. this way even database specific functionality is available (though this might break database
independence).
ordering is as simple as selecting different attributes
ComposedType unitType = jaloSession.getTypeManager().getComposedType(Unit.class);
String query = "SELECT {" + Item.PK + "} FROM {" + unitType.getCode() + "}" + "ORDER BY {" + Unit.CODE + "} ASC";
List unitsOrdered = jaloSession.getFlexibleSearch().search(query.toString, // the query text
Collections.EMPTY_MAP, // no values needed here
Collections.singletonList(Unit.class), // the expected result (row) signature
true, // fail on unknown (untyped) fields
true, // don't need total
0, -1 // result range start = 0, count = -1 (unlimited)
).getResult();
a special note on properties: when order by contains properties which are stored in separate tables these tables are
outer joined automatically since non existence of the property would avoid the actual item to be found
otherwise.
localized properties require that a language is specified for searching. normally
search(SessionContext, String, Map, List, boolean, boolean, int, int) uses the current session language.
SessionContext myLangCtx = jaloSession.createSessionContext();
myLangCtx.setLanguage( jaloSession.getC2LManager().getLanguage( "FR" ) );
jaloSession.getFlexibleSearch().search( myLangCtx, ... );
further it is possible to specify a fixed language for each localized attribute - even multiple different languages
per query. please note that this generates as many joins to localized property tables as languages are specified,
so be careful.
Language langDE = jaloSession.getC2LManager().getLanguiage("DE");
Language langEN = jaloSession.getC2LManager().getLanguiage("EN");
String query = "SELECT {PK} FROM {MyType} WHERE {locAttr[" + langDE.getPK() + "]} = 'x' AND " + "{locAttr2[" + langEN.getPK()
+ "]} = 'y' AND " + "{locAttr3} = 'z'";
the example uses infact 3 languages: the session language for locAttr3, langDE for locAttr
and langEN for locAttr2. the fixed languages are passed as language pk strings.
values should be passed similar to JDBC prepared statements. unlike JDBC flexible search allows named values - this way the same value may be referenced at multiple places without the need to build a value list.
String query = "SELECT {PK} FROM {MyType} WHERE {attr} = ?value OR {attr2} = ?value";
Map values = new HashMap();
values.put( "value", "xyz" );
jaloSession.getFlexibleSearch().search( query, values, ... );
besides explicitly defined values a query may reference all session context attributes too. these attributes are
named "session."+attribute name. predefined session attributes are
SessionContext.USER, SessionContext.LANGUAGE and
SessionContext.CURRENCY.
ComposedType orderType = jaloSession.getTypeManager().getComposedType( Order.class );
String query = "SELECT {"Item.PK+"} FROM {"+orderType.getCode()+"} WHERE {"+Order.USER+"} = ?session."+SessionContext.USER +
" AND {"+Order.CURRENCY+"} = ?session."+SessionContext.CURRENCY;
List userOrders = jaloSession.getFlexibleSearch().search(
query,
Collections.EMPTY_MAP, // no values required since we use a session attribute
Collections.singletonList( Order.class ),
true, // fail on unknown
true, // don't need total
0, -1 // get all
).getResult();
further it is possible to access even attributes of the actual (item) values inside the value map.
Map values = new HashMap();
values.put("country", jaloSession.getC2LManager().getCountry("DE"));
values.put("region", jaloSession.getC2LManager().getRegionByCode("sachsen"));
String query = "SELECT {" + Item.PK + "} FROM {" + jaloSession.getTypeManager().getComposedType(Language.class).getCode()
+ "} AS lang " + "WHERE {lang:" + Language.ISOCODE + "} IN( ?country." + Country.ISOCODE + ", ?region." + Region.COUNTRY
+ "." + Country.ISOCODE + " )";
generally stating from one item each readable attribute is usable - if it is an item too further traversal is
possible.
joins between types are allowed. currently inner joins and left outer joins are allowed.
String productType = jaloSession.getTypeManager().getComposedType( Product.class ).getCode();
STring cartEntryType = jaloSession.getTypeManager().getComposedType( CartEntry.class ).getCode();
String query =
"SELECT {p:"Item.PK+"}, {e:"CartEntry.UNIT+"}, SUM( {e:"CartEntry.QUANTITY+"} ) AS amount "+
"FROM {"+productType+" AS p JOIN "+cartEntryType+" AS e ON {p:"+Item.PK+"} = {e:"+CartEntry.PRODUCT+"} "+
"ORDER BY amount DESC "+
"GROUP BY {p:"+Item.PK+"}, {e:"CartEntry.UNIT+"};
final List productCartLists = jaloSession.getFlexibleSearch().search(
query,
Collections.EMPTY_MAP,
Arrays.asList( new Class[]{Product.class,Unit.class,Long.class}),
true,
true,
0, -1
).getResult();
System.out.println("products currently in carts");
for( int i = 0, s = productCartLists.size(); i < s ; i++ )
{
List row = (List)productCartLists.get(i);
Product p = (Product)row.get(0);
Unit u = (Unit)row.get(1);
long quantity = ((Long)row.get(2)).longValue();
System.out.println("\t"+p.getCode()+" -> "+quantity+" "+u.getCode());
}
the above example produces a list of all products which are currently held in carts grouped by the ordered unit and
show the total quantity. since this is no left (outer) join all products which are not inside a cart don't show up in
the result.
using properties requires some additional thought when searching for absence of values or properties not
having a certain value.
background: since localized and unoptimized properties are stored in separate tables they have to be joined to be
included them in the query. a non-existing property row (e.g. when no value has been written for the current language
yet) will cause the item not be found (except any property used in order by , see above )
an example:
Language l = jaloSession.getC2LManager().createLanguage( "fresh" );
SessionContext myCtx = jaloSession.createSessionContext();
myCtx.setLanguage( l );
List list = jaloSession.getFlexibleSearch().search(
myCtx,
"SELECT {"+Item.PK+"} FROM {"jaloSession.getTypeManager().getComposedType(Product.class).getCode()+"}"+
"WHERE {"+Product.NAME+"} <> 'tom'";
Collections.EMPTY_MAP,
Collections.singletonList( Product.class ),
true,
true,
0, 1
).getResult();
// list should be empty now since no product can own a property for the newly created language
the solution here is the o attribute modifier. this forces the property table to be outer joined.
nevertheless the query has to be changed as well to achieve the desired result here:
as seen here aIS NULLcheck has to be added since even though the property row is outer joinedcolumn <> 'xyz'will fail since the column is in fact NULL.
generally it is advised to avoid such queries whenever possible. trying to set default values is always a far better solution than searching for absence ( IS NULL ) in properties.there is a special syntax for subselects too. please note that subselects are not available in case the underlying database doesn't support them!
String productType = jaloSession.getTypeManager().getComoposedType(Product.class).getCode(); String orderEntryType = jaloSession.getTypeManager().getComoposedType(OrderEntry.class).getCode(); String query = "SELECT {" + Item.PK + "} FROM {" + productType + " AS p} WHERE " + " EXISTS ( {{" + "SELECT {" + Item.PK + "} FROM {" + orderEntryType + "} WHERE {" + OrderEntry.PRODUCT + "} = {p:" + Item.PK + "} " + // be sure to have a space between the last '}' and '}}' - this is a know issue right now "}} )";subselects may contain all features as normal queries including joins and nested subselects.the result of a flexible query is always limited to the queried type, which means result items are instances of the queried type or any of its subtypes. it is possible to select instances of one type exactly by appending a
!to the type code.String query = "SELECT {PK} FROM {MyType!}";
| Modifier and Type | Class and Description |
|---|---|
static class |
FlexibleSearch.FlexibleSearchCacheKey
Deprecated.
Special case we do not handle AbstractLegacyRegistrableCacheKey because we need to extend it.
|
protected static class |
FlexibleSearch.FlexibleSearchSerializableDTO
Deprecated.
|
Manager.GenericManagerSingletonCreator, Manager.ManagerSingletonCreator| Modifier and Type | Field and Description |
|---|---|
static String |
BEAN_NAME
Deprecated.
|
static String |
CACHE_TTL
Deprecated.
|
static String |
CTX_SEARCH_RESTRICTIONS
Deprecated.
|
static String |
DISABLE_CACHE
Deprecated.
|
static String |
DISABLE_EXECUTION
Deprecated.
|
static String |
DISABLE_RESTRICTION_GROUP_INHERITANCE
Deprecated.
|
static String |
DISABLE_RESTRICTIONS
Deprecated.
|
static String |
DISABLE_SESSION_ATTRIBUTES
Deprecated.
|
static long |
interval
Deprecated.
|
static String |
PREFETCH_SIZE
Deprecated.
Search option for controlling the result prefetch size.
|
static Comparator |
VALUE_COMPARATOR
Deprecated.
|
| Constructor and Description |
|---|
FlexibleSearch()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addContextQueryFilter(ContextQueryFilter filter)
Deprecated.
|
void |
addContextQueryFilter(SessionContext ctx,
ContextQueryFilter filter)
Deprecated.
|
void |
addContextQueryFilters(Collection<ContextQueryFilter> filters)
Deprecated.
|
void |
addContextQueryFilters(SessionContext ctx,
Collection<ContextQueryFilter> filters)
Deprecated.
|
protected void |
checkBeforeItemRemoval(SessionContext ctx,
Item item)
Deprecated.
Superclass method overridden to avoid call to EJB layer
|
String |
checkQuery(String query,
boolean disableRestrictions)
Deprecated.
|
void |
clearContextQueryFilters()
Deprecated.
|
void |
clearContextQueryFilters(SessionContext ctx)
Deprecated.
|
SavedQuery |
createSavedQuery(String code,
ComposedType resultType,
String query,
Map params)
Deprecated.
Creates a new saved query upon a given composed type.
|
protected boolean |
disableExecution(SessionContext ctx)
Deprecated.
|
protected boolean |
disablePrincipalGroupRestrictions(SessionContext ctx)
Deprecated.
|
protected boolean |
disableRestrictions(SessionContext ctx)
|
protected boolean |
disableSessionAttributes(SessionContext ctx)
Deprecated.
|
protected SearchResult |
executeSearch(TranslatedQuery tQuery,
Map values,
PK langPK,
List<Class<?>> resultClasses,
boolean dontNeedTotal,
int start,
int count,
int prefetchSize,
Set<PK> prefetchLanguages,
boolean doExecuteQuery)
Deprecated.
|
static Object |
getCacheUnit()
Deprecated.
since 4.8
|
Collection<ContextQueryFilter> |
getContextQueryFilters()
Deprecated.
|
Collection<ContextQueryFilter> |
getContextQueryFilters(SessionContext ctx)
Deprecated.
|
protected Collection<ContextQueryFilter> |
getContextQueryFilters(SessionContext ctx,
Collection<ComposedType> types)
|
static FlexibleSearch |
getInstance()
Deprecated.
|
Set<AbstractQueryFilter> |
getQueryFilters(Principal principal,
ComposedType type,
boolean includeGroups,
boolean includeSuperTypes,
boolean includeSubtypes)
Deprecated.
use
SearchRestrictionService.getSessionSearchRestrictions()
or
SearchRestrictionService.getSearchRestrictions(de.hybris.platform.core.model.security.PrincipalModel, boolean, Collection)
or
SearchRestrictionService.getSearchRestrictions(de.hybris.platform.core.model.security.PrincipalModel, boolean, Collection)
instead. |
QueryParser |
getQueryParser()
Deprecated.
Gets the used query parser which is responsible fpr translating queries and caching them.
|
protected Principal |
getRestrictionPrincipal(SessionContext ctx)
Deprecated.
|
SavedQuery |
getSavedQuery(String code)
Deprecated.
Finds a saved query by its code.
|
protected String |
getSearchDebug(SessionContext ctx,
String query,
List resultClasses,
boolean failOnUnknown,
boolean dontNeedTotal,
int start,
int count,
int prefetchSize)
Deprecated.
|
protected PK |
getSearchLangPK(SessionContext ctx)
Deprecated.
|
protected int |
getSearchPrefetchSize(SessionContext ctx)
Deprecated.
|
protected int |
getTTL(SessionContext ctx)
Deprecated.
|
protected Collection<AbstractQueryFilter> |
getUserFilters(Principal principal,
boolean includeGroups,
Collection<ComposedType> types)
Deprecated.
|
void |
init()
Deprecated.
called once for each tenant, so this method fits best to perform some initialization stuff
|
protected boolean |
isCachingDisabled(SessionContext localCtx)
Deprecated.
|
boolean |
isRestrictionEvaluationDisabled(SessionContext ctx)
Deprecated.
Tells whether or not search restriction evaluation is currently disabled for a specified session context.
|
boolean |
isTypeRestricted(SessionContext ctx,
ComposedType type,
boolean includingSubtypes)
|
protected Map |
listToMap(List list)
Deprecated.
|
protected void |
notifyItemRemoval(SessionContext ctx,
Item item)
Deprecated.
Superclass method overridden to avoid call to EJB layer
|
void |
removeContextQueryFilter(ContextQueryFilter filter)
Deprecated.
|
void |
removeContextQueryFilter(SessionContext ctx,
ContextQueryFilter filter)
Deprecated.
|
void |
removeContextQueryFilters(Collection<ContextQueryFilter> filters)
Deprecated.
|
void |
removeContextQueryFilters(SessionContext ctx,
Collection<ContextQueryFilter> filters)
Deprecated.
|
SearchResult |
search(SessionContext ctx,
String query,
List values,
List resultClasses,
boolean failOnUnknownFields,
boolean dontNeedTotal,
boolean ignoreEmptyProperties,
int start,
int count,
String timeoutCacheKey)
Deprecated.
|
SearchResult |
search(SessionContext ctx,
String query,
Map values,
Class resultClass)
Deprecated.
|
SearchResult |
search(SessionContext _ctx,
String query,
Map values,
List resultClasses,
boolean failOnUnknownFields,
boolean dontNeedTotal,
int start,
int count)
Deprecated.
|
SearchResult |
search(SessionContext ctx,
String query,
Map values,
List resultClasses,
boolean failOnUnknownFields,
boolean dontNeedTotal,
int start,
int count,
String timeoutCacheKey)
Deprecated.
please use
search(SessionContext, String, Map, List, boolean, boolean, int, int) instead |
SearchResult |
search(String query,
Class resultClass)
Deprecated.
|
SearchResult |
search(String query,
List values,
List resultClasses,
boolean failOnUnknownFields,
boolean dontNeedTotal,
boolean ignoreEmptyProperties,
int start,
int count,
String timeoutCacheKey)
Deprecated.
please use
search(String, Map, List, boolean, boolean, int, int, String) instead |
SearchResult |
search(String query,
Map values,
Class resultClass)
Deprecated.
|
SearchResult |
search(String query,
Map values,
List resultClasses,
boolean failOnUnknownFields,
boolean dontNeedTotal,
int start,
int count)
Deprecated.
|
SearchResult |
search(String query,
Map values,
List resultClasses,
boolean failOnUnknownFields,
boolean dontNeedTotal,
int start,
int count,
String timeoutCacheKey)
Deprecated.
please use
search(String, Map, List, boolean, boolean, int, int) instead |
void |
setContextQueryFilters(Collection<ContextQueryFilter> filters)
Deprecated.
Sets or replaces all dynamic query filters of the current session context.
|
void |
setContextQueryFilters(SessionContext ctx,
Collection<ContextQueryFilter> filters)
Deprecated.
Sets or replaces all dynamic query filters of a specific session context.
|
protected TranslatedQuery |
translate(SessionContext ctx,
Principal principal,
String query,
int valueCount,
boolean hasLanguage,
boolean failOnUnknownFields,
boolean disableRestrictions,
boolean disableGrouprestrictions,
Map values)
Deprecated.
|
protected Object |
translateObject(SessionContext ctx,
Object tmp,
String[] qualifiers,
int i,
String key)
Deprecated.
|
protected Map |
translatePathValueKeys(SessionContext ctx,
List valueKeys,
Map _values)
Deprecated.
|
protected SearchResult |
wrapSearchResult(SearchResult cachedSearchResult)
Deprecated.
wraps a cache based
SearchResult, return instance which is intended not to share its business internals
with others. |
Object |
writeReplace()
Deprecated.
|
afterItemCreation, beforeItemCreation, destroy, getAllValuesSessionContext, getAttribute, getAttributeMap, getFirstItemByAttribute, getFirstItemByAttribute, getRemote, getRemoteManagerClass, getSession, getSingletonManagerInstance, getTenant, getTransientObject, getTransientObjectMap, setAttribute, setTenant, setTransientObject, unwrap, unwrap, wrappublic static final String BEAN_NAME
public static final Comparator VALUE_COMPARATOR
public static final String DISABLE_RESTRICTIONS
public static final String DISABLE_RESTRICTION_GROUP_INHERITANCE
public static final String DISABLE_SESSION_ATTRIBUTES
public static final String DISABLE_EXECUTION
public static final String CACHE_TTL
public static final String CTX_SEARCH_RESTRICTIONS
public static final String DISABLE_CACHE
public static final String PREFETCH_SIZE
lazy.pkcollection.prefetchsize.
To set a custom prefetch size simply add a PREFETCH_SIZE parameter to the session context passed to the search method.
public static long interval
@Deprecated public static Object getCacheUnit()
@Deprecated public void addContextQueryFilter(ContextQueryFilter filter)
SearchRestrictionService.addSessionSearchRestrictions(Collection)
instead.ContextQueryFilter for details.filter - the query filter to add@Deprecated public void addContextQueryFilter(SessionContext ctx, ContextQueryFilter filter)
SearchRestrictionService.addSessionSearchRestrictions(Collection)
instead.ContextQueryFilter for details.ctx - the session context to add tofilter - the filter to add@Deprecated public void addContextQueryFilters(Collection<ContextQueryFilter> filters)
SearchRestrictionService.addSessionSearchRestrictions(Collection)
instead.ContextQueryFilter for details.filters - the filters to add@Deprecated public void addContextQueryFilters(SessionContext ctx, Collection<ContextQueryFilter> filters)
SearchRestrictionService.addSessionSearchRestrictions(Collection)
instead.ContextQueryFilter for details.ctx - the context to add tofilters - the filters to add to@Deprecated public String checkQuery(String query, boolean disableRestrictions) throws FlexibleSearchException
FlexibleSearchService.translate(de.hybris.platform.servicelayer.search.FlexibleSearchQuery)
instead.query - the flexible querydisableRestrictions - if true no restrictions are included even if some exists for the current user and the searched type(s)FlexibleSearchException - in case of a translation error@Deprecated public void clearContextQueryFilters()
SearchRestrictionService.clearSessionSearchRestrictions()
instead.ContextQueryFilter for details.@Deprecated public void clearContextQueryFilters(SessionContext ctx)
SearchRestrictionService.clearSessionSearchRestrictions()
instead.ContextQueryFilter for details.public SavedQuery createSavedQuery(String code, ComposedType resultType, String query, Map params) throws FlexibleSearchException
SELECT {PK} ... )SavedQuery.TYPE_PLACEHOLDER to allow
applying the saved query even to subtypes of the specified return type
jaloSession.createSavedQuery(
"FindUnnamedProducts",
jaloSession.getTypeManager().getComposedType( Product.class ),
"SELECT {p:PK} FROM {"+SavedQuery.TYPE_PLACEHOLDER+" AS p} "+
"WHERE {p:name:o} IS NULL"
null
);
code - the code of the saved queryresultType - the type upon this query can be appliedquery - the query text as full flexible search expressionparams - the value params as map of { qualifier -> Type }FlexibleSearchException - if the query is no valid flexible search query@Deprecated public Collection<ContextQueryFilter> getContextQueryFilters()
SearchRestrictionService.getSessionSearchRestrictions()
instead.ContextQueryFilter for details.@Deprecated public Collection<ContextQueryFilter> getContextQueryFilters(SessionContext ctx)
SearchRestrictionService.getSessionSearchRestrictions()
instead.ContextQueryFilter for details.ctx - the session context to check@Deprecated public Set<AbstractQueryFilter> getQueryFilters(Principal principal, ComposedType type, boolean includeGroups, boolean includeSuperTypes, boolean includeSubtypes)
SearchRestrictionService.getSessionSearchRestrictions()
or
SearchRestrictionService.getSearchRestrictions(de.hybris.platform.core.model.security.PrincipalModel, boolean, Collection)
or
SearchRestrictionService.getSearchRestrictions(de.hybris.platform.core.model.security.PrincipalModel, boolean, Collection)
instead.public QueryParser getQueryParser()
public SavedQuery getSavedQuery(String code)
public void init()
Managerpublic boolean isRestrictionEvaluationDisabled(SessionContext ctx)
@Deprecated public boolean isTypeRestricted(SessionContext ctx, ComposedType type, boolean includingSubtypes)
SearchRestrictionService.hasRestrictions(de.hybris.platform.core.model.security.PrincipalModel, boolean, de.hybris.platform.core.model.type.ComposedTypeModel)
instead.isRestrictionEvaluationDisabled(SessionContext) for that!ctx - the session context to search for restrictions withintype - the type to check restrictions forincludingSubtypes - if true this method also returns true if any of the type's sub types has got
active restrictions@Deprecated public void removeContextQueryFilter(ContextQueryFilter filter)
SearchRestrictionService.removeSessionSearchRestrictions(Collection)
instead.ContextQueryFilter for details.filter - the filter to remove@Deprecated public void removeContextQueryFilter(SessionContext ctx, ContextQueryFilter filter)
SearchRestrictionService.removeSessionSearchRestrictions(Collection)
instead.ContextQueryFilter for details.ctx - the context to remove fromfilter - the filter to remove@Deprecated public void removeContextQueryFilters(Collection<ContextQueryFilter> filters)
SearchRestrictionService.removeSessionSearchRestrictions(Collection)
instead.ContextQueryFilter for details.filters - the filters to remove@Deprecated public void removeContextQueryFilters(SessionContext ctx, Collection<ContextQueryFilter> filters)
SearchRestrictionService.removeSessionSearchRestrictions(Collection)
instead.ContextQueryFilter for details.ctx - the context to remove fromfilters - the filter to remove@Deprecated public SearchResult search(SessionContext ctx, String query, List values, List resultClasses, boolean failOnUnknownFields, boolean dontNeedTotal, boolean ignoreEmptyProperties, int start, int count, String timeoutCacheKey) throws FlexibleSearchException
search(SessionContext, String, Map, List, boolean, boolean, int, int, String)
insteadctx - the session contextquery - the whole queryvalues - the value map according to all ?<key>resultClasses - a list with the expected result types of this query's result rowsfailOnUnknownFields - causes an error when using an unknown field namedontNeedTotal - optimzed query procesing for large results with small ranges selectedignoreEmptyProperties - start - the start number of the search rangecount - the number of elements in this search rangetimeoutCacheKey - FlexibleSearchExceptionpublic SearchResult search(SessionContext ctx, String query, Map values, Class resultClass) throws FlexibleSearchException
ctx - the session context defining which language is used for localized fieldsquery - the whole queryvalues - the value map according to all ?<key>resultClass - a list with the expected result types of this query's result rowsFlexibleSearchException - in case of a search errorpublic SearchResult search(SessionContext _ctx, String query, Map values, List resultClasses, boolean failOnUnknownFields, boolean dontNeedTotal, int start, int count) throws FlexibleSearchException
_ctx - the session context defining which language is used for localized fieldsquery - the whole queryvalues - the value map according to all ?<key>resultClasses - a list with the expected result types of this query's result rowsfailOnUnknownFields - causes an error when using an unknown field namedontNeedTotal - optimized query processing for large results with small ranges selectedstart - the start number of the search rangecount - the number of elements in this search rangeFlexibleSearchException - in case of a search errorprotected boolean isCachingDisabled(SessionContext localCtx)
protected SearchResult wrapSearchResult(SearchResult cachedSearchResult) throws Exception
SearchResult, return instance which is intended not to share its business internals
with others.Exception@Deprecated public SearchResult search(SessionContext ctx, String query, Map values, List resultClasses, boolean failOnUnknownFields, boolean dontNeedTotal, int start, int count, String timeoutCacheKey) throws FlexibleSearchException
search(SessionContext, String, Map, List, boolean, boolean, int, int) insteadctx - the search contextquery - the whole queryvalues - the value map according to all ?<key>resultClasses - a list with the expected result types of this query's result rowsfailOnUnknownFields - causes an error when using an unknown field namedontNeedTotal - optimzed query procesing for large results with small ranges selectedstart - the start number of the search rangecount - the number of elements in this search rangetimeoutCacheKey - FlexibleSearchException - in case of a search errorpublic SearchResult search(String query, Class resultClass) throws FlexibleSearchException
query - the whole queryresultClass - a list with the expected result types of this query's result rowsFlexibleSearchException - in case of a search error@Deprecated public SearchResult search(String query, List values, List resultClasses, boolean failOnUnknownFields, boolean dontNeedTotal, boolean ignoreEmptyProperties, int start, int count, String timeoutCacheKey) throws FlexibleSearchException
search(String, Map, List, boolean, boolean, int, int, String) insteadquery - the whole queryvalues - the value map according to all ?<key>resultClasses - a list with the expected result types of this query's result rowsfailOnUnknownFields - causes an error when using an unknown field namedontNeedTotal - optimzed query procesing for large results with small ranges selectedignoreEmptyProperties - start - the start number of the search rangecount - the number of elements in this search rangetimeoutCacheKey - FlexibleSearchExceptionpublic SearchResult search(String query, Map values, Class resultClass) throws FlexibleSearchException
query - the whole queryvalues - the value map according to all ?<key>resultClass - a list with the expected result types of this query's result rowsFlexibleSearchException - in case of a search errorpublic SearchResult search(String query, Map values, List resultClasses, boolean failOnUnknownFields, boolean dontNeedTotal, int start, int count) throws FlexibleSearchException
query - the whole queryvalues - the value map according to all ?<key>resultClasses - a list with the expected result types of this query's result rowsfailOnUnknownFields - causes an error when using an unknown field namedontNeedTotal - optimzed query procesing for large results with small ranges selectedstart - the start number of the search rangecount - the number of elements in this search rangeFlexibleSearchException - in case of a search error@Deprecated public SearchResult search(String query, Map values, List resultClasses, boolean failOnUnknownFields, boolean dontNeedTotal, int start, int count, String timeoutCacheKey) throws FlexibleSearchException
search(String, Map, List, boolean, boolean, int, int) insteadquery - the whole queryvalues - the value map according to all ?<key>resultClasses - a list with the expected result types of this query's result rowsfailOnUnknownFields - causes an error when using an unknown field namedontNeedTotal - optimzed query procesing for large results with small ranges selectedstart - the start number of the search rangecount - the number of elements in this search rangetimeoutCacheKey - FlexibleSearchException - in case of a search errorpublic void setContextQueryFilters(Collection<ContextQueryFilter> filters)
ContextQueryFilter for
details.filters - the new filters to setpublic void setContextQueryFilters(SessionContext ctx, Collection<ContextQueryFilter> filters)
ContextQueryFilter for
details.ctx - the context to set filters atfilters - the filters to setpublic Object writeReplace() throws ObjectStreamException
writeReplace in class ManagerObjectStreamExceptionprotected void checkBeforeItemRemoval(SessionContext ctx, Item item) throws ConsistencyCheckException
checkBeforeItemRemoval in class Managerctx - the current session contextitem - the item which should be removedConsistencyCheckException - thrown to abort removal due to consistency errorsprotected boolean disableExecution(SessionContext ctx)
protected boolean disablePrincipalGroupRestrictions(SessionContext ctx)
@Deprecated protected boolean disableRestrictions(SessionContext ctx)
protected boolean disableSessionAttributes(SessionContext ctx)
protected SearchResult executeSearch(TranslatedQuery tQuery, Map values, PK langPK, List<Class<?>> resultClasses, boolean dontNeedTotal, int start, int count, int prefetchSize, Set<PK> prefetchLanguages, boolean doExecuteQuery) throws FlexibleSearchException
tQuery - values - langPK - resultClasses - dontNeedTotal - start - count - FlexibleSearchException@Deprecated protected Collection<ContextQueryFilter> getContextQueryFilters(SessionContext ctx, Collection<ComposedType> types)
protected Principal getRestrictionPrincipal(SessionContext ctx)
protected String getSearchDebug(SessionContext ctx, String query, List resultClasses, boolean failOnUnknown, boolean dontNeedTotal, int start, int count, int prefetchSize)
protected PK getSearchLangPK(SessionContext ctx)
protected int getSearchPrefetchSize(SessionContext ctx)
protected int getTTL(SessionContext ctx)
protected Collection<AbstractQueryFilter> getUserFilters(Principal principal, boolean includeGroups, Collection<ComposedType> types)
protected void notifyItemRemoval(SessionContext ctx, Item item)
notifyItemRemoval in class Managerctx - the currency session contextitem - the item which is going to be removedprotected TranslatedQuery translate(SessionContext ctx, Principal principal, String query, int valueCount, boolean hasLanguage, boolean failOnUnknownFields, boolean disableRestrictions, boolean disableGrouprestrictions, Map values) throws FlexibleSearchException
FlexibleSearchExceptionprotected Object translateObject(SessionContext ctx, Object tmp, String[] qualifiers, int i, String key)
protected Map translatePathValueKeys(SessionContext ctx, List valueKeys, Map _values)
public static FlexibleSearch getInstance()
Copyright © 2017 SAP SE. All Rights Reserved.