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 theConditionassociated with this Query.intgetLimit()Retrieves the number of elements to retrieve.intRetrieves 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.booleanDetermines whether or not an index refresh is needed before performing this QueryvoidsetCondition(Condition condition) Sets theConditionassociated with this Query.voidsetForceRefresh(boolean forceRefresh) Specifies whether or not an index refresh is needed before performing this Query.voidsetLimit(int limit) Sets the number of elements to retrieve.voidsetOffset(int offset) Sets the offset of the first element to be retrievedvoidsetScrollIdentifier(String scrollIdentifier) voidsetScrollTimeValidity(String scrollTimeValidity) voidSets the String representation of the sorting specifications for this Query if any.voidSets 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
nullif 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 ornullif 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
-1if 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-1if all of them should be retrieved
-
getSortby
Retrieves the sorting specifications for this Query in String format, if any.- Returns:
- an optional (
nullif 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:ascordesc.
-
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 ornullif no sorting is required
-
getCondition
Retrieves theConditionassociated with this Query.- Returns:
- the
Conditionassociated with this Query
-
setCondition
Sets theConditionassociated with this Query.- Parameters:
condition- theConditionassociated with this Query
-
isForceRefresh
public boolean isForceRefresh()Determines whether or not an index refresh is needed before performing this Query- Returns:
trueif an index refresh is needed before performing this Query,falseotherwise
-
setForceRefresh
public void setForceRefresh(boolean forceRefresh) Specifies whether or not an index refresh is needed before performing this Query.- Parameters:
forceRefresh-trueif an index refresh is needed before performing this Query,falseotherwise
-
getScrollIdentifier
-
setScrollIdentifier
-
getScrollTimeValidity
-
setScrollTimeValidity
-