Class IndexingFieldSearchUICriterion
java.lang.Object
org.ametys.runtime.parameter.Parameter<MetadataType>
org.ametys.cms.search.ui.model.impl.AbstractSearchUICriterion
org.ametys.cms.search.ui.model.impl.IndexingFieldSearchUICriterion
- All Implemented Interfaces:
Field
,IndexingFieldSearchCriterion
,SearchCriterion
,SearchUICriterion
,LogEnabled
,Disposable
,Configurable
,Contextualizable
,Serviceable
public class IndexingFieldSearchUICriterion
extends AbstractSearchUICriterion
implements IndexingFieldSearchCriterion, Contextualizable, LogEnabled, Disposable
This class is a search criteria on a metadata of a content
-
Field Summary
Modifier and TypeFieldDescriptionprotected ThreadSafeComponentManager<Enumerator>
ComponentManager forEnumerator
s.protected String
The field pathprotected String
The field full pathprotected HierarchicalReferenceTablesHelper
The content search helper.protected boolean
Is it AND or OR for multiple metadataThe join pathsprotected Query.Operator
The criteria operatorprotected ContentSearchHelper
The content search helper.protected UserHelper
The user helperprotected ThreadSafeComponentManager<Validator>
ComponentManager forValidator
s.static final String
Prefix for id of metadata search criteriaFields inherited from class org.ametys.cms.search.ui.model.impl.AbstractSearchUICriterion
_contentHelper, _cTypeEP, _resolver, _userManager, _userPopulationDAO
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(Configuration configuration) void
contextualize
(Context context) void
dispose()
protected Query
getBooleanQuery
(Object value, String fieldPath, Query.Operator operator) Get a boolean query.protected Query
getContentQuery
(Object value, String language, String fieldPath, Query.Operator operator) Get a content query.protected Query
getDateQuery
(Object value, String fieldPath, Query.Operator operator) Get a date query.protected Query
getDoubleQuery
(Object value, String fieldPath, Query.Operator operator) Get a double query.Get the field identifier.Get the path of field (separated by '/')protected String
getFieldPath
(IndexingField indexingField, String[] remainingPathSegments) Get the field's path without join pathsprotected Query
getGeocodeQuery
(Object value, String fieldPath, Query.Operator operator) Get a geocode query.Get the join paths, separated with slashes.protected Query
getLongQuery
(Object value, String fieldPath, Query.Operator operator) Get a long query.protected MetadataDefinition
getMetadataDefinition
(IndexingField indexingField, String[] remainingPathSegments, List<String> joinPaths) Get the metadata definition from the indexing field.Get the operator.getQuery
(Object value, Query.Operator customOperator, Map<String, Object> allValues, String language, Map<String, Object> contextualParameters) Get theQuery
associated to the given value.protected Query
getRichTextQuery
(Object value, String language, String fieldPath, Query.Operator operator, boolean isValueEscaped) Get a rich text query.Get theSearchField
representing this search criterion.protected Query
getStringQuery
(Object value, String language, String fieldPath, Query.Operator operator, boolean isValueEscaped) Get a string query.protected Query
getTextQuery
(Object value, String language, String fieldPath, Query.Operator operator, boolean isValueEscaped) Get a text query.protected Query
getUserQuery
(Object value, String fieldPath, Query.Operator operator) Get a user queryvoid
service
(ServiceManager manager) void
Called at creation time to provide aLogger
.Methods inherited from class org.ametys.cms.search.ui.model.impl.AbstractSearchUICriterion
_configureI18nizableText, _initializeValidator, configureId, configureLabelsAndGroup, configureUIProperties, configureValues, configureWidget, configureWidgetParameters, getChangeClassName, getContentTypeId, getFacetLabel, getGroup, getInitClassName, getMetadataDefinition, getSubmitClassName, isHidden, isMultiple, setChangeClassName, setContentTypeId, setGroup, setHidden, setInitClassName, setMultiple, setSubmitClassName
Methods inherited from class org.ametys.runtime.parameter.Parameter
getDefaultValue, getDescription, getEnumerator, getId, getLabel, getPluginName, getType, getValidator, getWidget, getWidgetParameters, setDefaultValue, setDescription, setEnumerator, setId, setLabel, setPluginName, setType, setValidator, setWidget, setWidgetParameters
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ametys.cms.search.model.Field
getContentTypeId, getEnumerator, getType, isMultiple
Methods inherited from interface org.ametys.cms.search.model.SearchCriterion
getId, getQuery, isFacetable, isSortable
Methods inherited from interface org.ametys.cms.search.ui.model.SearchUICriterion
getDefaultValue, getDescription, getLabel, getValidator, getWidget, getWidgetParameters
-
Field Details
-
SEARCH_CRITERIA_METADATA_PREFIX
Prefix for id of metadata search criteria- See Also:
-
_searchHelper
The content search helper. -
_hierarchicalReferenceTablesHelper
The content search helper. -
_userHelper
The user helper -
_operator
The criteria operator -
_fullPath
The field full path -
_fieldPath
The field path -
_joinPaths
The join paths -
_isMultipleOperandAnd
Is it AND or OR for multiple metadata -
_validatorManager
ComponentManager forValidator
s. -
_enumeratorManager
ComponentManager forEnumerator
s.
-
-
Constructor Details
-
IndexingFieldSearchUICriterion
public IndexingFieldSearchUICriterion()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
setLogger
Description copied from interface:LogEnabled
Called at creation time to provide aLogger
.- Specified by:
setLogger
in interfaceLogEnabled
- Parameters:
logger
- aLogger
for messages.
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSearchUICriterion
- Throws:
ServiceException
-
dispose
- Specified by:
dispose
in interfaceDisposable
-
configure
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractSearchUICriterion
- Throws:
ConfigurationException
-
getOperator
Get the operator.- Specified by:
getOperator
in interfaceSearchCriterion
- Returns:
- the operator.
-
getFieldId
Description copied from interface:SearchUICriterion
Get the field identifier. Used to match standard, advanced and faceted criterion (even if the operator is different), whatever their ID is.- Specified by:
getFieldId
in interfaceSearchUICriterion
- Returns:
- the field identifier.
-
getFieldPath
Get the path of field (separated by '/')- Specified by:
getFieldPath
in interfaceIndexingFieldSearchCriterion
- Returns:
- the path of the field.
-
getJoinPaths
Get the join paths, separated with slashes.- Specified by:
getJoinPaths
in interfaceIndexingFieldSearchCriterion
- Returns:
- the join paths.
-
getQuery
public Query getQuery(Object value, Query.Operator customOperator, Map<String, Object> allValues, String language, Map<String, Object> contextualParameters) Description copied from interface:SearchCriterion
Get theQuery
associated to the given value.- Specified by:
getQuery
in interfaceSearchCriterion
- Parameters:
value
- The user-submitted value (or the default value if not set) for this criterion.customOperator
- In advanced search mode, the operator chosen by the user.null
to use the criterion-defined operator (simple search mode).allValues
- All the user-submitted values.language
- The current search language.contextualParameters
- the search contextual parameters.- Returns:
Query
associated to the given value.
-
getStringQuery
protected Query getStringQuery(Object value, String language, String fieldPath, Query.Operator operator, boolean isValueEscaped) Get a string query.- Parameters:
value
- The value to use for this criterion.language
- The search language.fieldPath
- The field path.operator
- The query operator to use.isValueEscaped
-true
if the given value is already escaped- Returns:
- The query.
-
getBooleanQuery
Get a boolean query.- Parameters:
value
- The value to use for this criterion.fieldPath
- The field path.operator
- The query operator to use.- Returns:
- The query.
-
getDoubleQuery
Get a double query.- Parameters:
value
- The value to use for this criterion.fieldPath
- The field path.operator
- The query operator to use.- Returns:
- The query.
-
getLongQuery
Get a long query.- Parameters:
value
- The value to use for this criterion.fieldPath
- The field path.operator
- The query operator to use.- Returns:
- The query.
-
getDateQuery
Get a date query.- Parameters:
value
- The value to use for this criterion.fieldPath
- The field path.operator
- The query operator to use.- Returns:
- The query.
-
getContentQuery
protected Query getContentQuery(Object value, String language, String fieldPath, Query.Operator operator) Get a content query.- Parameters:
value
- The value to use for this criterion.language
- The search language.fieldPath
- The field path.operator
- The query operator to use.- Returns:
- The query.
-
getUserQuery
Get a user query- Parameters:
value
- The value to use for this criterion.fieldPath
- The field path.operator
- The query operator to use.- Returns:
- The query.
-
getGeocodeQuery
Get a geocode query.- Parameters:
value
- The value to use for this criterion.fieldPath
- The field path.operator
- The query operator to use.- Returns:
- The query.
-
getRichTextQuery
protected Query getRichTextQuery(Object value, String language, String fieldPath, Query.Operator operator, boolean isValueEscaped) Get a rich text query.- Parameters:
value
- The value to use for this criterion.language
- The search language.fieldPath
- The field path.operator
- The query operator to use.isValueEscaped
-true
if the given value is already escaped- Returns:
- The query.
-
getTextQuery
protected Query getTextQuery(Object value, String language, String fieldPath, Query.Operator operator, boolean isValueEscaped) Get a text query.- Parameters:
value
- The value to use for this criterion.language
- The search language.fieldPath
- The field path.operator
- The query operator to use.isValueEscaped
-true
if the given value is already escaped- Returns:
- The query.
-
getSearchField
Description copied from interface:SearchCriterion
Get theSearchField
representing this search criterion.- Specified by:
getSearchField
in interfaceSearchCriterion
- Overrides:
getSearchField
in classAbstractSearchUICriterion
- Returns:
- the
SearchField
representing this search criterion.
-
getMetadataDefinition
protected MetadataDefinition getMetadataDefinition(IndexingField indexingField, String[] remainingPathSegments, List<String> joinPaths) throws ConfigurationException Get the metadata definition from the indexing field. Can be null if the last indexing field is a custom indexing field.- Parameters:
indexingField
- The initial indexing fieldremainingPathSegments
- The path to access the metadata or an another indexing field from the initial indexing fieldjoinPaths
- The consecutive's path in case of joint to access the field/metadata- Returns:
- The metadata definition or null if not found
- Throws:
ConfigurationException
- If an error occurs.
-
getFieldPath
protected String getFieldPath(IndexingField indexingField, String[] remainingPathSegments) throws ConfigurationException Get the field's path without join paths- Parameters:
indexingField
- The initial indexing fieldremainingPathSegments
- The path to access the metadata or an another indexing field from the initial indexing field- Returns:
- the field's path
- Throws:
ConfigurationException
- If an error occurs.
-