Package org.ametys.cms.search.query
Class ContentQuery
- java.lang.Object
-
- org.ametys.cms.search.query.AbstractFieldQuery
-
- org.ametys.cms.search.query.ContentQuery
-
- All Implemented Interfaces:
Query
public class ContentQuery extends AbstractFieldQuery
Represents aQuery
testing a content field.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ametys.cms.search.query.Query
Query.LogicalOperator, Query.Operator
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentHelper
_contentHelper
The extension point.protected boolean
_isAndMultipleOperand
true
if the query should be executed with an AndQuery.protected Query.Operator
_operator
The operatorprotected HierarchicalReferenceTablesHelper
_refTableHelper
The helper to resolve the reference tables.protected boolean
_resolveChildren
true
if the query should be executed by resolving the children.protected AmetysObjectResolver
_resolver
The resolver to resolve the results.protected Object
_value
The value to test.-
Fields inherited from class org.ametys.cms.search.query.AbstractFieldQuery
_fieldPath
-
-
Constructor Summary
Constructors Constructor Description ContentQuery(String fieldPath, Query.Operator operator, Object value, AmetysObjectResolver resolver, ContentHelper contentHelper)
Build a content query.ContentQuery(String fieldPath, Query.Operator operator, Object value, AmetysObjectResolver resolver, ContentHelper contentHelper, boolean isAndMultipleOperand)
Build a content query by testing the operand.ContentQuery(String fieldPath, Query.Operator operator, Object value, AmetysObjectResolver resolver, ContentHelper contentHelper, HierarchicalReferenceTablesHelper refTableHelper, boolean resolveChildren)
Build a content query by testing if the ancestors should be resolved.ContentQuery(String fieldPath, Query.Operator operator, Object value, AmetysObjectResolver resolver, ContentHelper contentHelper, HierarchicalReferenceTablesHelper refTableHelper, boolean resolveChildren, boolean isAndMultipleOperand)
Build a content query by testing the operand and if the ancestors should be resolved.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Query
_createQueryString(Object value, Query.Operator operator)
private Query
_createRefParentsQuery(Collection<String> values, Query.Operator operator)
Create a subQuery in order to create the join queryprivate Set<String>
_getChildrenOrSelf(String id)
private Query
_getChildrenOrSelfQuery(Collection<String> values, Query.Operator operator)
String
build()
Build the solr query string representing the Query object.boolean
equals(Object obj)
Object
getValue()
Get the value.int
hashCode()
-
Methods inherited from class org.ametys.cms.search.query.AbstractFieldQuery
getFieldPath
-
-
-
-
Field Detail
-
_operator
protected Query.Operator _operator
The operator
-
_resolver
protected AmetysObjectResolver _resolver
The resolver to resolve the results.
-
_contentHelper
protected ContentHelper _contentHelper
The extension point.
-
_isAndMultipleOperand
protected boolean _isAndMultipleOperand
true
if the query should be executed with an AndQuery.
-
_refTableHelper
protected HierarchicalReferenceTablesHelper _refTableHelper
The helper to resolve the reference tables.
-
_resolveChildren
protected boolean _resolveChildren
true
if the query should be executed by resolving the children.
-
-
Constructor Detail
-
ContentQuery
public ContentQuery(String fieldPath, Query.Operator operator, Object value, AmetysObjectResolver resolver, ContentHelper contentHelper)
Build a content query.- Parameters:
fieldPath
- the field's pathoperator
- the operatorvalue
- the valueresolver
- the resolvercontentHelper
- the content helper
-
ContentQuery
public ContentQuery(String fieldPath, Query.Operator operator, Object value, AmetysObjectResolver resolver, ContentHelper contentHelper, boolean isAndMultipleOperand)
Build a content query by testing the operand.- Parameters:
fieldPath
- the field's pathoperator
- the operatorvalue
- the valueresolver
- the resolvercontentHelper
- the content helperisAndMultipleOperand
- 'true' to execute an AndQuery, OrQuery otherwise
-
ContentQuery
public ContentQuery(String fieldPath, Query.Operator operator, Object value, AmetysObjectResolver resolver, ContentHelper contentHelper, HierarchicalReferenceTablesHelper refTableHelper, boolean resolveChildren)
Build a content query by testing if the ancestors should be resolved.- Parameters:
fieldPath
- the field's pathoperator
- the operatorvalue
- the valueresolver
- the resolvercontentHelper
- the content helperrefTableHelper
- The helper to resolve the ancestorsresolveChildren
- 'true' to execute an OrQuery on the ancestors and itself, 'false' will execute a join request
-
ContentQuery
public ContentQuery(String fieldPath, Query.Operator operator, Object value, AmetysObjectResolver resolver, ContentHelper contentHelper, HierarchicalReferenceTablesHelper refTableHelper, boolean resolveChildren, boolean isAndMultipleOperand)
Build a content query by testing the operand and if the ancestors should be resolved.- Parameters:
fieldPath
- the field's pathoperator
- The operator. OnlyQuery.Operator.EQ
andQuery.Operator.NE
are allowed.value
- the valueresolver
- the resolvercontentHelper
- the content helperrefTableHelper
- The helper to resolve the ancestorsresolveChildren
- 'true' to execute an OrQuery on the ancestors and itself, 'false' will execute a join requestisAndMultipleOperand
- 'true' to execute an AndQuery, OrQuery otherwise
-
-
Method Detail
-
build
public String build() throws QuerySyntaxException
Description copied from interface:Query
Build the solr query string representing the Query object.- Returns:
- the solr query string representing the Query object.
- Throws:
QuerySyntaxException
- if the query can't be built because of a syntax error.
-
_getChildrenOrSelfQuery
private Query _getChildrenOrSelfQuery(Collection<String> values, Query.Operator operator)
-
_getChildrenOrSelf
private Set<String> _getChildrenOrSelf(String id)
-
_createQueryString
private Query _createQueryString(Object value, Query.Operator operator)
-
_createRefParentsQuery
private Query _createRefParentsQuery(Collection<String> values, Query.Operator operator)
Create a subQuery in order to create the join query- Parameters:
values
- the values to add in the queryoperator
- the operator- Returns:
- The non-null query
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractFieldQuery
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classAbstractFieldQuery
-
-