public class DefaultIndexedDataFactory extends Object implements IndexedDataFactory
IndexedDataFactory(see
GeneratedIndexConfiguration.setIndexedDataFactoryClassName(String)).
Subclasses can overwrite the protected methods to adapt the IndexedDataFactory's behaviour.
| Constructor and Description |
|---|
DefaultIndexedDataFactory() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addGroupingSearchFields(IndexConfiguration config,
StringBuilder query,
List classes)
Adds the
grouping attribute, if one is set. |
protected List |
buildIndexedDataList(IndexConfiguration config,
List rows)
Convert the FlexibleSearch result into a list of
IndexedData objects. |
void |
documentCreated(IndexConfiguration config,
IndexedData data,
Document doc)
Does nothing right now.
|
Collection |
getActivationAttributes(IndexConfiguration config)
Deprecated.
|
protected String |
getActivationClause(IndexConfiguration config,
Map searchValues)
Subclasses may overwrite this method to restrict which items are included in the index.
|
protected List<de.hybris.platform.lucenesearch.jalo.DefaultIndexedDataFactory.LangIndexSearchBunch> |
getDataSearchFields(IndexConfiguration config)
Gets the list of the
LangIndexSearchBunches |
Collection |
getGroupingAttributes(IndexConfiguration config)
Deprecated.
|
Collection |
getIndexableAttributes(IndexConfiguration config)
Provides all attributes of the composed type of the specified
IndexConfiguration which this factory is
able to translate into index data. |
List<PK> |
getIndexableItems(IndexConfiguration config)
Provides all indexable items for the specified configuration.
|
Collection<IndexedData> |
getIndexedData(IndexConfiguration config,
Collection<Item> items)
Calls
searchIndexedData(de.hybris.platform.lucenesearch.jalo.IndexConfiguration, java.lang.String, java.util.Map)with an additional condition restricting the query to the given item, and passes
the result to buildIndexedDataList(de.hybris.platform.lucenesearch.jalo.IndexConfiguration, java.util.List). |
protected Collection<AttributeConfiguration> |
getNonSelectableAttributes(Collection<AttributeConfiguration> cfgs) |
protected List<AttributeConfiguration> |
getSelectableAttributes(Collection<AttributeConfiguration> cfgs) |
protected boolean |
isAttributeIndexable(AttributeDescriptor attributeDescriptor)
A attribute is indexable only if
its attribute type is
String, or
the attribute has been explicitely marked indexable via
GeneratedLucenesearchConstants.Attributes.AttributeDescriptor.FORCELUCENEINDEXABLE
|
protected boolean |
isFlexibleSearchSelectable(AttributeConfiguration cfg) |
protected boolean |
isNextBunchNeeded()
Returns true if next bunch must be created increases index only for MySQL
|
boolean |
needUpdate(IndexConfiguration config,
Date lastRebuildTimestamp)
Determines update status by counting all indexable items which
Item.MODIFIED_TIME
is empty or newer than the given rebuild timestamp. |
protected List<PK> |
searchIndexableItens(IndexConfiguration config,
String additionalConditionQuery,
Map additionalConditionValues) |
protected List |
searchIndexedData(IndexConfiguration config,
String additionalConditionQuery,
Map additionalConditionValues)
Build and execute a FlexibleSearch query, using the methods
addGroupingSearchFields,
getActivationClause.
|
protected String |
valueToString(SessionContext locCtx,
Object rowValue) |
public Collection getIndexableAttributes(IndexConfiguration config)
IndexedDataFactoryIndexConfiguration which this factory is
able to translate into index data.getIndexableAttributes in interface IndexedDataFactoryconfig - the index configuration specifying the actual ComposedType@Deprecated public Collection getGroupingAttributes(IndexConfiguration config)
IndexedDataFactorygetGroupingAttributes in interface IndexedDataFactory@Deprecated public Collection getActivationAttributes(IndexConfiguration config)
getActivationAttributes in interface IndexedDataFactoryprotected boolean isAttributeIndexable(AttributeDescriptor attributeDescriptor)
String, orGeneratedLucenesearchConstants.Attributes.AttributeDescriptor.FORCELUCENEINDEXABLE
attributeDescriptor - public boolean needUpdate(IndexConfiguration config, Date lastRebuildTimestamp)
Item.MODIFIED_TIME
is empty or newer than the given rebuild timestamp.
Please note that this does not reflect changes which do not alter the
Item.MODIFIED_TIME attribute!
needUpdate in interface IndexedDataFactoryconfig - the index configuration to check status forlastRebuildTimestamp - the last index rebuild or update timeprotected List searchIndexedData(IndexConfiguration config, String additionalConditionQuery, Map additionalConditionValues)
The query is built as SELECT PK dataSearchFields groupingSearchFields
FROM { fromClause }
[ WHERE ] activationClause [ AND ] additionalCondition
ORDER BY PK
.
protected List<PK> searchIndexableItens(IndexConfiguration config, String additionalConditionQuery, Map additionalConditionValues)
protected List<AttributeConfiguration> getSelectableAttributes(Collection<AttributeConfiguration> cfgs)
protected Collection<AttributeConfiguration> getNonSelectableAttributes(Collection<AttributeConfiguration> cfgs)
protected boolean isFlexibleSearchSelectable(AttributeConfiguration cfg)
protected List<de.hybris.platform.lucenesearch.jalo.DefaultIndexedDataFactory.LangIndexSearchBunch> getDataSearchFields(IndexConfiguration config)
LangIndexSearchBunchesconfig - the IndexConfiguration query that is the list of the LangIndexSearchBunch being built ofprotected boolean isNextBunchNeeded()
If the limit of BUNCH_SIZE is reached returns true else returns false
protected String valueToString(SessionContext locCtx, Object rowValue)
protected List buildIndexedDataList(IndexConfiguration config, List rows)
IndexedData objects.
Consecutive data lists in searchResult for the same PK are merged into a single IndexedData.
They are expected to be identical in all data fields, and to differ only in the grouping field. This allows
subclasses to get n-to-m grouping information from joined tables (see addGroupingSearchFields(de.hybris.platform.lucenesearch.jalo.IndexConfiguration, java.lang.StringBuilder, java.util.List)).
config - IndexConfigurationrows - a List of rowsIndexedDataobjectsprotected void addGroupingSearchFields(IndexConfiguration config, StringBuilder query, List classes)
grouping attribute, if one is set. If this
method is overridden for a custom grouping implementation, it is still necessary to set a (arbitrary) grouping
attribute; otherwise buildIndexedDataList(de.hybris.platform.lucenesearch.jalo.IndexConfiguration, java.util.List)will not be able to read the search result. Additionaly, the hmc
lucenesearch screen will not be able to determine the possible grouping values unless the grouping attribute is
set appropriately.query - the FlexibleSearch query that is being builtclasses - the result classes of the FlexibleSearchprotected String getActivationClause(IndexConfiguration config, Map searchValues)
activation attribute,
if it is set.searchValues - the search values of the FlexibleSearchpublic Collection<IndexedData> getIndexedData(IndexConfiguration config, Collection<Item> items)
searchIndexedData(de.hybris.platform.lucenesearch.jalo.IndexConfiguration, java.lang.String, java.util.Map)with an additional condition restricting the query to the given item, and passes
the result to buildIndexedDataList(de.hybris.platform.lucenesearch.jalo.IndexConfiguration, java.util.List).getIndexedData in interface IndexedDataFactorypublic List<PK> getIndexableItems(IndexConfiguration config)
getIndexableItems in interface IndexedDataFactoryconfig - the index configuration to get all items forpublic void documentCreated(IndexConfiguration config, IndexedData data, Document doc)
documentCreated in interface IndexedDataFactoryconfig - the index configuration which this document has been created fordata - the data record which provided all document fields.doc - the new document objectCopyright © 2017 SAP SE. All Rights Reserved.