Package org.apache.unomi.api.query
Class Query
java.lang.Object
org.apache.unomi.api.query.Query
- All Implemented Interfaces:
Serializable
A query wrapper gathering all elements needed for a potentially complex CXS query:
Condition
, offset, limit, sorting specification, etc.
Created by kevan on 14/05/15.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves theCondition
associated with this Query.int
getLimit()
Retrieves the number of elements to retrieve.int
Retrieves the offset of the first element to be retrievedRetrieves the sorting specifications for this Query in String format, if any.getText()
Retrieves the text to be used in full-text searches, if any.boolean
Determines whether or not an index refresh is needed before performing this Queryvoid
setCondition
(Condition condition) Sets theCondition
associated with this Query.void
setForceRefresh
(boolean forceRefresh) Specifies whether or not an index refresh is needed before performing this Query.void
setLimit
(int limit) Sets the number of elements to retrieve.void
setOffset
(int offset) Sets the offset of the first element to be retrievedvoid
setScrollIdentifier
(String scrollIdentifier) void
setScrollTimeValidity
(String scrollTimeValidity) void
Sets the String representation of the sorting specifications for this Query if any.void
Sets to be used in full-text searches
-
Constructor Details
-
Query
public Query()Instantiates a new Query.
-
-
Method Details
-
getText
Retrieves the text to be used in full-text searches, if any.- Returns:
- the text to be used in full-text searches or
null
if no full-text search is needed for this Query
-
setText
Sets to be used in full-text searches- Parameters:
text
- the text to be used in full-text searches ornull
if no full-text search is needed for this Query
-
getOffset
public int getOffset()Retrieves the offset of the first element to be retrieved- Returns:
- zero or a positive integer specifying the position of the first item to be retrieved in the total ordered collection of matching items
-
setOffset
public void setOffset(int offset) Sets the offset of the first element to be retrieved- Parameters:
offset
- zero or a positive integer specifying the position of the first item to be retrieved in the total ordered collection of matching items
-
getLimit
public int getLimit()Retrieves the number of elements to retrieve.- Returns:
- a positive integer specifying how many matching items should be retrieved or
-1
if all of them should be retrieved
-
setLimit
public void setLimit(int limit) Sets the number of elements to retrieve.- Parameters:
limit
- a positive integer specifying how many matching items should be retrieved or-1
if all of them should be retrieved
-
getSortby
Retrieves the sorting specifications for this Query in String format, if any.- Returns:
- an optional (
null
if no sorting is required) String of comma (,
) separated property names on which ordering should be performed, ordering elements according to the property order in the String, considering each in turn and moving on to the next one in case of equality of all preceding ones. Each property name is optionally followed by a column (:
) and an order specifier:asc
ordesc
.
-
setSortby
Sets the String representation of the sorting specifications for this Query if any. SeegetSortby()
method documentation for format.- Parameters:
sortby
- the String representation of the sorting specifications for this Query ornull
if no sorting is required
-
getCondition
Retrieves theCondition
associated with this Query.- Returns:
- the
Condition
associated with this Query
-
setCondition
Sets theCondition
associated with this Query.- Parameters:
condition
- theCondition
associated with this Query
-
isForceRefresh
public boolean isForceRefresh()Determines whether or not an index refresh is needed before performing this Query- Returns:
true
if an index refresh is needed before performing this Query,false
otherwise
-
setForceRefresh
public void setForceRefresh(boolean forceRefresh) Specifies whether or not an index refresh is needed before performing this Query.- Parameters:
forceRefresh
-true
if an index refresh is needed before performing this Query,false
otherwise
-
getScrollIdentifier
-
setScrollIdentifier
-
getScrollTimeValidity
-
setScrollTimeValidity
-