Package org.ametys.cms.search.content
Class ContentSearchHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.cms.search.content.ContentSearchHelper
- All Implemented Interfaces:
 LogEnabled,Component,Contextualizable,Serviceable
public class ContentSearchHelper
extends AbstractLogEnabled
implements Component, Serviceable, Contextualizable
Component which helps content searching by providing a simple way to access
 content properties (either attributes or properties).
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescription_computeJoinPaths(String dataPath, String prefix, Collection<? extends ModelItemAccessor> modelItemAccessors, boolean addLast) Retrieves the join paths from the given data path_computeJoinPaths(String dataPath, String prefix, ModelItemAccessor modelItemAccessor, boolean addLast) Retrieves the join paths from the given data path_computeJoinPaths(ViewItem viewItem) Retrieves the join paths from the given view itemcomputeFieldPath(ModelItem definition) Get the field path for the model item.computeJoinPaths(String dataPath, Set<String> contentTypeIds, boolean addLast) Retrieves the join paths from the given data pathvoidcontextualize(Context context) getMetadataSearchField(List<String> joinPaths, String metadataPath, MetadataType metadataType, boolean isTypeContentWithMultilingualTitle) Get aSearchFieldcorresponding to a metadata.getSearchField(Collection<String> contentTypes, String fieldPath) Get aSearchFieldfrom a field name in a batch of content types.getSearchField(ModelViewItem modelViewItem) Get aSearchFieldfrom a model view item.booleanisTitleMultilingual(ModelItem modelItem) Determines if the given model item represents an attribute of type content with contents with multilingual titlesvoidservice(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger 
- 
Field Details
- 
ROLE
The component role. 
 - 
 - 
Constructor Details
- 
ContentSearchHelper
public ContentSearchHelper() 
 - 
 - 
Method Details
- 
contextualize
- Specified by:
 contextualizein interfaceContextualizable- Throws:
 ContextException
 - 
service
- Specified by:
 servicein interfaceServiceable- Throws:
 ServiceException
 - 
getMetadataSearchField
public SearchField getMetadataSearchField(List<String> joinPaths, String metadataPath, MetadataType metadataType, boolean isTypeContentWithMultilingualTitle) Get aSearchFieldcorresponding to a metadata.- Parameters:
 joinPaths- The join pathsmetadataPath- The metadata path.metadataType- The metadata type.isTypeContentWithMultilingualTitle-trueif the type is Content and the linked contents have multilingual titles- Returns:
 - the search field.
 
 - 
getSearchField
Get aSearchFieldfrom a field name in a batch of content types.- Parameters:
 contentTypes- The content types, can be empty to search on any content type. In that case, only the title metadata and system properties will be usable in sort and facets specs.fieldPath- The field path, can be either a system property ID or a indexing field name or path.- Returns:
 - The 
SearchFieldcorresponding to the field path, or anempty optionalif not found 
 - 
computeJoinPaths
public List<String> computeJoinPaths(String dataPath, Set<String> contentTypeIds, boolean addLast) throws UndefinedItemPathException Retrieves the join paths from the given data path- Parameters:
 dataPath- the data pathcontentTypeIds- the ids of the content types containing the items of the given pathaddLast-trueto add the last join path element to the list,falseotherwise.- Returns:
 - the join paths
 - Throws:
 UndefinedItemPathException- if there is no item defined at the given path in given item accessors
 - 
_computeJoinPaths
protected List<String> _computeJoinPaths(String dataPath, String prefix, ModelItemAccessor modelItemAccessor, boolean addLast) throws UndefinedItemPathException Retrieves the join paths from the given data path- Parameters:
 dataPath- the data pathprefix- the prefix of current join pathmodelItemAccessor- the model item to access the items of the given pathaddLast-trueto add the last join path element to the list,falseotherwise.- Returns:
 - the join paths
 - Throws:
 UndefinedItemPathException- if there is no item defined at the given path in given item accessor
 - 
_computeJoinPaths
protected List<String> _computeJoinPaths(String dataPath, String prefix, Collection<? extends ModelItemAccessor> modelItemAccessors, boolean addLast) throws UndefinedItemPathException Retrieves the join paths from the given data path- Parameters:
 dataPath- the data pathprefix- the prefix of current join pathmodelItemAccessors- the model items to access the items of the given pathaddLast-trueto add the last join path element to the list,falseotherwise.- Returns:
 - the join paths
 - Throws:
 UndefinedItemPathException- if there is no item defined at the given path in given item accessors
 - 
getSearchField
Get aSearchFieldfrom a model view item.- Parameters:
 modelViewItem- The model view item- Returns:
 - The 
SearchFieldcorresponding to given model view item 
 - 
_computeJoinPaths
Retrieves the join paths from the given view item- Parameters:
 viewItem- the view item- Returns:
 - the join paths
 
 - 
isTitleMultilingual
Determines if the given model item represents an attribute of type content with contents with multilingual titles- Parameters:
 modelItem- The model item- Returns:
 trueif the given model item represents an attribute of type content with contents with multilingual titles
 - 
computeFieldPath
Get the field path for the model item.- Parameters:
 definition- the model item- Returns:
 - the field path
 
 
 -