Package org.apache.unomi.api.query
Class Query
- java.lang.Object
-
- org.apache.unomi.api.query.Query
-
- All Implemented Interfaces:
Serializable
public class Query extends Object implements 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Query()Instantiates a new Query.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConditiongetCondition()Retrieves theConditionassociated with this Query.intgetLimit()Retrieves the number of elements to retrieve.intgetOffset()Retrieves the offset of the first element to be retrievedStringgetScrollIdentifier()StringgetScrollTimeValidity()StringgetSortby()Retrieves the sorting specifications for this Query in String format, if any.StringgetText()Retrieves the text to be used in full-text searches, if any.booleanisForceRefresh()Determines 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)voidsetSortby(String sortby)Sets the String representation of the sorting specifications for this Query if any.voidsetText(String text)Sets to be used in full-text searches
-
-
-
Method Detail
-
getText
public String 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
public void setText(String text)
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
public String 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
public void setSortby(String sortby)
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
public Condition getCondition()
Retrieves theConditionassociated with this Query.- Returns:
- the
Conditionassociated with this Query
-
setCondition
public void setCondition(Condition condition)
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
public String getScrollIdentifier()
-
setScrollIdentifier
public void setScrollIdentifier(String scrollIdentifier)
-
getScrollTimeValidity
public String getScrollTimeValidity()
-
setScrollTimeValidity
public void setScrollTimeValidity(String scrollTimeValidity)
-
-