public class ElasticFilterFactory extends FilterFactory<ElasticConstraint>
ElasticQuery
.Elastic.FILTERS
Constructor and Description |
---|
ElasticFilterFactory() |
Modifier and Type | Method and Description |
---|---|
sirius.db.es.constraints.ElasticCSVFilter |
containsAll(Mapping field,
sirius.kernel.commons.Value commaSeparatedValues)
Creates a new constraint for the given field which asserts that all of the given values in the string is
present.
|
sirius.db.es.constraints.ElasticCSVFilter |
containsAny(Mapping field,
sirius.kernel.commons.Value commaSeparatedValues)
Creates a new constraint for the given field which asserts that one of the given values in the string is
present.
|
protected Object |
customTransform(Object value)
Permits to provive database dependent transformations.
|
protected ElasticConstraint |
effectiveAnd(List<ElasticConstraint> effectiveConstraints)
Combines the list of constraints using AND
|
protected ElasticConstraint |
effectiveOr(List<ElasticConstraint> effectiveConstraints)
Combines the list of constraints using OR
|
protected ElasticConstraint |
eqValue(Mapping field,
Object value)
Represents field = value as constraint
|
ElasticConstraint |
filled(Mapping field)
Generates a constraint which ensures that the given field is filled (not null)
|
protected ElasticConstraint |
gtValue(Mapping field,
Object value,
boolean orEqual)
Represents field > value as constraint
|
protected ElasticConstraint |
invert(ElasticConstraint constraint)
Effectively inverts the given constraint
|
protected ElasticConstraint |
ltValue(Mapping field,
Object value,
boolean orEqual)
Represents field < value as constraint
|
NestedQuery |
nested(Mapping field)
Executes a nested query.
|
ElasticConstraint |
nestedMapContains(Mapping mapField,
String key,
String value)
Creates a filter which ensures, that a nested
StringMap
or StringListMap contains the given key and value. |
protected ElasticConstraint |
neValue(Mapping field,
Object value)
Represents field !
|
ElasticConstraint |
notFilled(Mapping field)
Generates a constraint which ensures that the given field is not filled (null)
|
ElasticConstraint |
prefix(Mapping field,
String value)
Creates a prefix query.
|
ElasticConstraint |
queryString(EntityDescriptor descriptor,
String query,
List<QueryField> fields)
Compiles the given query for the given entity while searching in the given fields.
|
and, and, containsNone, containsOne, eq, eqIgnoreEmpty, eqOrEmpty, gt, gte, gteOrEmpty, gtOrEmpty, lt, lte, lteOrEmpty, ltOrEmpty, ne, noneInField, not, oneInField, or, or, queryString, transform
protected Object customTransform(Object value)
FilterFactory
customTransform
in class FilterFactory<ElasticConstraint>
value
- the value to tranformprotected ElasticConstraint eqValue(Mapping field, Object value)
FilterFactory
eqValue
in class FilterFactory<ElasticConstraint>
field
- the field to filtervalue
- the value to filter withprotected ElasticConstraint neValue(Mapping field, Object value)
FilterFactory
neValue
in class FilterFactory<ElasticConstraint>
field
- the field to filtervalue
- the value to filter withprotected ElasticConstraint gtValue(Mapping field, Object value, boolean orEqual)
FilterFactory
gtValue
in class FilterFactory<ElasticConstraint>
field
- the field to filtervalue
- the value to filter withorEqual
- if true, field >= value is used as comparatorprotected ElasticConstraint ltValue(Mapping field, Object value, boolean orEqual)
FilterFactory
ltValue
in class FilterFactory<ElasticConstraint>
field
- the field to filtervalue
- the value to filter withorEqual
- if true, field <= value is used as comparatorpublic ElasticConstraint filled(Mapping field)
FilterFactory
filled
in class FilterFactory<ElasticConstraint>
field
- the field to checkpublic ElasticConstraint notFilled(Mapping field)
FilterFactory
notFilled
in class FilterFactory<ElasticConstraint>
field
- the field to checkprotected ElasticConstraint invert(ElasticConstraint constraint)
FilterFactory
invert
in class FilterFactory<ElasticConstraint>
constraint
- the constraint to invertprotected ElasticConstraint effectiveAnd(List<ElasticConstraint> effectiveConstraints)
FilterFactory
effectiveAnd
in class FilterFactory<ElasticConstraint>
effectiveConstraints
- the constraints to combine (where each value will be non-null)protected ElasticConstraint effectiveOr(List<ElasticConstraint> effectiveConstraints)
FilterFactory
effectiveOr
in class FilterFactory<ElasticConstraint>
effectiveConstraints
- the constraints to combine (where each value will be non-null)public sirius.db.es.constraints.ElasticCSVFilter containsAny(Mapping field, sirius.kernel.commons.Value commaSeparatedValues)
FilterFactory
The string can have a form like A,B,C or A|B|C.
containsAny
in class FilterFactory<ElasticConstraint>
field
- the field to checkcommaSeparatedValues
- the comma separated values to check forpublic sirius.db.es.constraints.ElasticCSVFilter containsAll(Mapping field, sirius.kernel.commons.Value commaSeparatedValues)
FilterFactory
The string can have a form like A,B,C or A|B|C.
containsAll
in class FilterFactory<ElasticConstraint>
field
- the field to checkcommaSeparatedValues
- the comma separated values to check forpublic ElasticConstraint queryString(EntityDescriptor descriptor, String query, List<QueryField> fields)
FilterFactory
queryString
in class FilterFactory<ElasticConstraint>
descriptor
- the descriptor of the entity being searchedquery
- the query to compilefields
- the default fields to search inpublic NestedQuery nested(Mapping field)
Nested queries must be used along with nested lists
. Otherwise,
if there are several objects nested in a list, an entity would also match, if the filtered properties match
against any of the nested objects instead of all in a single one - which is most commonly wanted.
See: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html
field
- the list or inner map to querypublic ElasticConstraint nestedMapContains(Mapping mapField, String key, String value)
StringMap
or StringListMap
contains the given key and value.mapField
- the property which contains either a StringMap or StringListMapkey
- the key to check forvalue
- the value to check forpublic ElasticConstraint prefix(Mapping field, String value)
field
- the field to search invalue
- the prefix to filter byCopyright © 2018. All rights reserved.