public interface Filter extends BaseFilter
Modifier and Type | Method and Description |
---|---|
Filter |
addAndFilter(BaseFilter filter) |
void |
addBetween(String fieldAttributeName,
Calendar start,
Calendar end,
DateTools.Resolution resolution)
Adds a FAST DATE RANGE constraint that the Calendar value for
fieldAttributeName is between start and end (boundaries included) BASED ON the
granularity resolution . |
void |
addBetween(String fieldAttributeName,
Object value1,
Object value2)
Adds a constraint that the value
fieldAttributeName is between value1 and value2 (boundaries included). |
void |
addContains(String scope,
String fullTextSearch)
Adds a fulltext search to this Filter.
|
void |
addEqualTo(String fieldAttributeName,
Calendar calendar,
DateTools.Resolution resolution)
Adds a constraint that the Calendar value for
fieldAttributeName rounded to its resolution is equal to the
rounded value for calendar . |
void |
addEqualTo(String fieldAttributeName,
Object value)
Adds a constraint that the value
fieldAttributeName is equal to value |
void |
addEqualToCaseInsensitive(String fieldAttributeName,
String value)
Case insensitive testing of
fieldAttributeName for some value . |
void |
addGreaterOrEqualThan(String fieldAttributeName,
Calendar calendar,
DateTools.Resolution resolution)
note: supported resolutions are
DateTools.Resolution.YEAR ,
DateTools.Resolution.MONTH ,
DateTools.Resolution.DAY or
DateTools.Resolution.HOUR |
void |
addGreaterOrEqualThan(String fieldAttributeName,
Object value)
Adds a constraint that the value
fieldAttributeName is greater than or equal to value |
void |
addGreaterThan(String fieldAttributeName,
Calendar calendar,
DateTools.Resolution resolution)
note: supported resolutions are
DateTools.Resolution.YEAR ,
DateTools.Resolution.MONTH ,
DateTools.Resolution.DAY or
DateTools.Resolution.HOUR |
void |
addGreaterThan(String fieldAttributeName,
Object value)
Adds a constraint that the value
fieldAttributeName is greater than value |
void |
addIsNull(String fieldAttributeName)
Add a constraint that the result does NOT have the property
fieldAttributeName |
void |
addJCRExpression(String jcrExpression)
Adds the xpath
jcrExpression as constraint. |
void |
addLessOrEqualThan(String fieldAttributeName,
Calendar calendar,
DateTools.Resolution resolution)
note: supported resolutions are
DateTools.Resolution.YEAR ,
DateTools.Resolution.MONTH ,
DateTools.Resolution.DAY or
DateTools.Resolution.HOUR |
void |
addLessOrEqualThan(String fieldAttributeName,
Object value)
Adds a constraint that the value
fieldAttributeName is less than or equal to value |
void |
addLessThan(String fieldAttributeName,
Calendar calendar,
DateTools.Resolution resolution)
note: supported resolutions are
DateTools.Resolution.YEAR ,
DateTools.Resolution.MONTH ,
DateTools.Resolution.DAY or
DateTools.Resolution.HOUR |
void |
addLessThan(String fieldAttributeName,
Object value)
Adds a constraint that the value
fieldAttributeName is less than value |
void |
addLike(String fieldAttributeName,
Object value)
Deprecated.
Since 7.9.0 use
addLike(String, String) instead as the Object param was stringified anyway |
void |
addLike(String fieldAttributeName,
String value)
This function is based on the LIKE predicate found in SQL.
|
void |
addNotBetween(String fieldAttributeName,
Calendar start,
Calendar end,
DateTools.Resolution resolution)
note: supported resolutions are
DateTools.Resolution.YEAR ,
DateTools.Resolution.MONTH ,
DateTools.Resolution.DAY or
DateTools.Resolution.HOUR |
void |
addNotBetween(String fieldAttributeName,
Object value1,
Object value2)
Adds a constraint that the value
fieldAttributeName is NOT between value1 and value2 ,
including NOT value1 and value2 |
void |
addNotContains(String scope,
String fullTextSearch)
The negated version of
addContains(String, String) |
void |
addNotEqualTo(String fieldAttributeName,
Calendar calendar,
DateTools.Resolution resolution)
note: supported resolutions are
DateTools.Resolution.YEAR ,
DateTools.Resolution.MONTH ,
DateTools.Resolution.DAY or
DateTools.Resolution.HOUR |
void |
addNotEqualTo(String fieldAttributeName,
Object value)
Adds a constraint that the value
fieldAttributeName is NOT equal to value |
void |
addNotEqualToCaseInsensitive(String fieldAttributeName,
String value)
Case insensitive testing of
fieldAttributeName for some value . |
void |
addNotLike(String fieldAttributeName,
Object value)
Deprecated.
Since 7.9.0 use
addNotLike(String, String) instead as the Object param was stringified anyway |
void |
addNotLike(String fieldAttributeName,
String value) |
void |
addNotNull(String fieldAttributeName)
Add a constraint that the result does have the property
fieldAttributeName , regardless its value |
Filter |
addOrFilter(BaseFilter filter) |
Filter |
negate()
Negates the current filter
|
getJcrExpression
void addContains(String scope, String fullTextSearch) throws FilterException
scope
. When the
scope
is just a .
, the search will be done on the entire document. When the scope
is
for example @myproject:title
, the free text search is done on this property only. You can also point to properties of
child nodes, for example a scope like myproject:paragraph/@myproject:header
scope
- the scope to search in. scope = "."
means searching in the entire node/document. scope = "example:title"
only
searches in the property "example:title". scope
is also allowed to be a path to a property in a descendant node, for example scope = "address/example:street"
. The
latter is equivalent to scope = "address/@example:street"
fullTextSearch
- the text to search onFilterException
- when scope
or fullTextSearch
is null
void addNotContains(String scope, String fullTextSearch) throws FilterException
addContains(String, String)
scope
- the scope to search in. scope = "."
means searching in the entire node/document. scope = "example:title"
only
searches in the property "example:title". scope
is also allowed to be a path to a property in a descendant node, for example scope = "address/example:street"
. The
latter is equivalent to scope = "address/@example:street"
fullTextSearch
- the text to search onFilterException
- when scope
or fullTextSearch
is null
addContains(String, String)
void addBetween(String fieldAttributeName, Object value1, Object value2) throws FilterException
Adds a constraint that the value fieldAttributeName
is between value1
and value2
(boundaries included).
note that for range queries on calendar/date instances where the granularity of, say Day, is enough, you
should use addBetween(String, java.util.Calendar, java.util.Calendar, DateTools.Resolution)
with the highest resolution that is acceptable for your use case, as this performs much better, OR make sure
that your application runs with a default resolution set to for example 'day'
fieldAttributeName
- the name of the attribute, eg "hippo:lastModified"value1
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
value2
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
, value1
or value2
are invalid types/values or one of them is null
void addBetween(String fieldAttributeName, Calendar start, Calendar end, DateTools.Resolution resolution) throws FilterException
fieldAttributeName
is between start
and end
(boundaries included) BASED ON the
granularity resolution
. Thus suppose the Resolution is Resolution.DAY
, then results with the same DAY as value for fieldAttributeName
will be included. The higher the Resolution (year is highest) the better the performance!fieldAttributeName
- the name of the attribute, eg "hippo:lastModified"start
- the date to start from (including)end
- the date to end (including)resolution
- the resolution to use to compare dates. The higher the Resolution (year is highest) the better the performance.
supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
FilterException
void addNotBetween(String fieldAttributeName, Object value1, Object value2) throws FilterException
Adds a constraint that the value fieldAttributeName
is NOT between value1
and value2
,
including NOT value1
and value2
note that for range queries on calendar/date instances where the granularity of, say Day, is enough, you
should use addNotBetween(String, java.util.Calendar, java.util.Calendar, DateTools.Resolution)
with the highest resolution that is acceptable for your use case, as this performs much better, OR make sure
that your application runs with a default resolution set to for example 'day'
fieldAttributeName
- the name of the attribute, eg "example:date"value1
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
value2
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
, value1
or value2
are invalid types/values or one of them is null
void addNotBetween(String fieldAttributeName, Calendar start, Calendar end, DateTools.Resolution resolution) throws FilterException
note: supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
void addEqualTo(String fieldAttributeName, Object value) throws FilterException
fieldAttributeName
is equal to value
fieldAttributeName
- the name of the attribute, eg "example:author"value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
void addEqualToCaseInsensitive(String fieldAttributeName, String value) throws FilterException
fieldAttributeName
for some value
.void addEqualTo(String fieldAttributeName, Calendar calendar, DateTools.Resolution resolution) throws FilterException
Adds a constraint that the Calendar value for fieldAttributeName
rounded to its resolution is equal to the
rounded value for calendar
. Thus assume the Resolution
is equal to Resolution.DAY
,
then all nodes/documents where the property fieldAttributeName
as a Calendar value with the calendar
rounded to days, will match.
supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
FilterException
void addNotEqualTo(String fieldAttributeName, Object value) throws FilterException
fieldAttributeName
is NOT equal to value
fieldAttributeName
- the name of the attribute, eg "example:author"value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
void addNotEqualToCaseInsensitive(String fieldAttributeName, String value) throws FilterException
fieldAttributeName
for some value
.void addNotEqualTo(String fieldAttributeName, Calendar calendar, DateTools.Resolution resolution) throws FilterException
note: supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
void addGreaterOrEqualThan(String fieldAttributeName, Object value) throws FilterException
Adds a constraint that the value fieldAttributeName
is greater than or equal to value
note that for range queries on calendar/date instances where the granularity of, say Day, is enough, you
should use addGreaterOrEqualThan(String, java.util.Calendar, DateTools.Resolution)
with the highest resolution that is acceptable for your use case, as this performs much better, OR make sure
that your application runs with a default resolution set to for example 'day'
fieldAttributeName
- the name of the attribute, eg "example:date"value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
void addGreaterOrEqualThan(String fieldAttributeName, Calendar calendar, DateTools.Resolution resolution) throws FilterException
note: supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
void addGreaterThan(String fieldAttributeName, Object value) throws FilterException
Adds a constraint that the value fieldAttributeName
is greater than value
note that for range queries on calendar/date instances where the granularity of, say Day, is enough, you
should use addGreaterThan(String, java.util.Calendar, org.hippoecm.repository.util.DateTools.Resolution)
with the highest resolution that is acceptable for your use case, as this performs much better, OR make sure
that your application runs with a default resolution set to for example 'day'
fieldAttributeName
- the name of the attribute, eg "example:date"value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
void addGreaterThan(String fieldAttributeName, Calendar calendar, DateTools.Resolution resolution) throws FilterException
note: supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
void addLessOrEqualThan(String fieldAttributeName, Object value) throws FilterException
Adds a constraint that the value fieldAttributeName
is less than or equal to value
note that for range queries on calendar/date instances where the granularity of, say Day, is enough, you
should use addLessOrEqualThan(String, java.util.Calendar, org.hippoecm.repository.util.DateTools.Resolution)
with the highest resolution that is acceptable for your use case, as this performs much better, OR make sure
that your application runs with a default resolution set to for example 'day'
fieldAttributeName
- the name of the attribute, eg "example:date"value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
void addLessOrEqualThan(String fieldAttributeName, Calendar calendar, DateTools.Resolution resolution) throws FilterException
note: supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
void addLessThan(String fieldAttributeName, Object value) throws FilterException
Adds a constraint that the value fieldAttributeName
is less than value
note that for range queries on calendar/date instances where the granularity of, say Day, is enough, you
should use addLessThan(String, java.util.Calendar, org.hippoecm.repository.util.DateTools.Resolution)
with the highest resolution that is acceptable for your use case, as this performs much better, OR make sure
that your application runs with a default resolution set to for example 'day'
fieldAttributeName
- the name of the attribute, eg "example:date"value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
void addLessThan(String fieldAttributeName, Calendar calendar, DateTools.Resolution resolution) throws FilterException
note: supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
void addLike(String fieldAttributeName, String value) throws FilterException
This function is based on the LIKE predicate found in SQL. This method maps to jcr:like
as
jcr:like($property as attribute(), $pattern as xs:string)
. Also see JCR spec 1.0 6.6.5.1 jcr:like
usage: For example, the query “Find all documents whose myproject:title
property starts with
hip
”, is expressed as: addLike("myproject:title","hip%")
.
The %
after hip
is the wildcard.
This method is particularly helpful in key kind of fields, where the key values contain chars on which
Lucene text indexing tokenizes. For example, "give me all the documents that have a key that start with JIRA key
HSTTW0-23
" can be expressed as addLike("myproject:key","HSTTW0-23%")
.
This results in documents having key HSTTW0-2345
, HSTTW0-2357
, etc.
DO NOT USE '%' AS A PREFIX. Thus do not use a query like
addLike("myproject:key","%HSTTW0-23%")
. Note the prefix '%'. Prefix wildcards blow up in memory and CPU
as they cannot be efficiently done in Lucene.
fieldAttributeName
- the name of the attribute, eg "example:author"value
- object that must be of type StringFilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
@Deprecated void addLike(String fieldAttributeName, Object value) throws FilterException
addLike(String, String)
instead as the Object param was stringified anywayFilterException
addLike(String, String)
void addNotLike(String fieldAttributeName, String value) throws FilterException
FilterException
only now inverted
@Deprecated void addNotLike(String fieldAttributeName, Object value) throws FilterException
addNotLike(String, String)
instead as the Object param was stringified anywayFilterException
only now inverted
void addNotNull(String fieldAttributeName) throws FilterException
fieldAttributeName
, regardless its valuefieldAttributeName
- the name of the attribute, eg "example:author"FilterException
- when fieldAttributeName
is null
void addIsNull(String fieldAttributeName) throws FilterException
fieldAttributeName
fieldAttributeName
- the name of the attribute, eg "example:author"FilterException
- when fieldAttributeName
is null
void addJCRExpression(String jcrExpression)
jcrExpression
as constraint. See jsr-170 spec for the xpath formatjcrExpression
- Filter addOrFilter(BaseFilter filter)
filter
- to OR addedFilter addAndFilter(BaseFilter filter)
filter
- to AND addedFilter negate()
Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.