Class QueryOptions
- java.lang.Object
-
- org.alfresco.repo.search.impl.querymodel.QueryOptions
-
- Direct Known Subclasses:
CMISQueryOptions
public class QueryOptions extends Object
The options for a query- Author:
- andyh
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classQueryOptions.Connective
-
Constructor Summary
Constructors Constructor Description QueryOptions(String query, StoreRef storeRef)Create a CMISQueryOptions instance with the default options other than the query and store ref.QueryOptions(String query, StoreRef storeRef, Locale locale)Create a CMISQueryOptions instance with the default options other than the query, store ref and locale.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringaddQueryTemplate(String name, String template)Add/replace a query template Not all languages support query templatesstatic QueryOptionscreate(SearchParameters searchParameters)SearchParametersgetAsSearchParmeters()StringgetDefaultFieldName()QueryOptions.ConnectivegetDefaultFTSConnective()Get the default connective used when OR and AND are not specified for the FTS contains() function.QueryOptions.ConnectivegetDefaultFTSFieldConnective()As getDefaultFTSConnective() but for field groupsbooleangetExcludeTenantFilter()List<Locale>getLocales()Get the list of locales to use for the queryintgetMaxItems()Get the max number of rows for the result set 0 or less is unlimitedintgetMaxPermissionChecks()longgetMaxPermissionCheckTimeMillis()IntegergetMaxRawResultSetSizeForInMemorySort()MLAnalysisModegetMlAnalaysisMode()Get the mode for multi-lingual text analaysisStringgetQuery()Get the query stringQueryConsistencygetQueryConsistency()List<QueryParameterDefinition>getQueryParameterDefinitions()Get the query parametersMap<String,String>getQueryTemplates()Get the query templatesLonggetSinceTxId()intgetSkipCount()Get the skip count - the number of rows to skip at the start of the query.List<StoreRef>getStores()Get the list of stores in which to run the query.BooleangetUseInMemorySort()booleanisBulkFetchEnabled()booleanisIncludeInTransactionData()Does the search include any changes made in the current transaction?voidsetBulkFetchEnabled(boolean isBulkFetchEnabled)voidsetDefaultFieldName(String defaultFieldName)voidsetDefaultFTSConnective(QueryOptions.Connective defaultFTSConnective)Set the default connective used when OR and AND are not specified for the FTS contains() function.voidsetDefaultFTSFieldConnective(QueryOptions.Connective defaultFTSFieldConnective)As setDefaultFTSConnective() but for field groupsvoidsetExcludeTenantFilter(boolean excludeTenantFilter)voidsetIncludeInTransactionData(boolean includeInTransactionData)Set to true if the search include any changes made in the current transaction.voidsetLocales(List<Locale> locales)sSet the list of locales to use for the queryvoidsetMaxItems(int maxItems)Set the max number of rows for the result set 0 or less is unlimitedvoidsetMaxPermissionChecks(int maxPermissionChecks)voidsetMaxPermissionCheckTimeMillis(long maxPermissionCheckTimeMillis)voidsetMaxRawResultSetSizeForInMemorySort(Integer maxRawResultSetSizeForInMemorySort)voidsetMlAnalaysisMode(MLAnalysisMode mlAnalaysisMode)Set the mode for multi-lingual text analaysisvoidsetQuery(String query)Set the query stringvoidsetQueryConsistency(QueryConsistency queryConsistency)voidsetQueryParameterDefinitions(List<QueryParameterDefinition> queryParameterDefinitions)Set the query parametersvoidsetSinceTxId(Long sinceTxId)voidsetSkipCount(int skipCount)Set the skip count - the number of rows to skip at the start of the query.voidsetStores(List<StoreRef> stores)Set the stores against which to run the query.voidsetUseInMemorySort(Boolean useInMemorySort)
-
-
-
Constructor Detail
-
QueryOptions
public QueryOptions(String query, StoreRef storeRef)
Create a CMISQueryOptions instance with the default options other than the query and store ref. The query will be run using the locale returned by I18NUtil.getLocale()- Parameters:
query- - the query to runstoreRef- - the store against which to run the query
-
-
Method Detail
-
create
public static QueryOptions create(SearchParameters searchParameters)
-
getQuery
public String getQuery()
Get the query string- Returns:
- the query
-
setQuery
public void setQuery(String query)
Set the query string- Parameters:
query- the query to set
-
getStores
public List<StoreRef> getStores()
Get the list of stores in which to run the query. Only one store is supported at the momentOnly one store is supported at the moment- Returns:
- the stores
-
setStores
public void setStores(List<StoreRef> stores)
Set the stores against which to run the query. Only one store is supported at the moment.- Parameters:
stores- the stores to set
-
getMaxItems
public int getMaxItems()
Get the max number of rows for the result set 0 or less is unlimited- Returns:
- the maxItems
-
setMaxItems
public void setMaxItems(int maxItems)
Set the max number of rows for the result set 0 or less is unlimited- Parameters:
maxItems- the maxItems to set
-
getSkipCount
public int getSkipCount()
Get the skip count - the number of rows to skip at the start of the query.- Returns:
- the skipCount
-
setSkipCount
public void setSkipCount(int skipCount)
Set the skip count - the number of rows to skip at the start of the query.- Parameters:
skipCount- the skipCount to set
-
getDefaultFTSConnective
public QueryOptions.Connective getDefaultFTSConnective()
Get the default connective used when OR and AND are not specified for the FTS contains() function.- Returns:
- the defaultFTSConnective
-
setDefaultFTSConnective
public void setDefaultFTSConnective(QueryOptions.Connective defaultFTSConnective)
Set the default connective used when OR and AND are not specified for the FTS contains() function.- Parameters:
defaultFTSConnective- the defaultFTSConnective to set
-
getDefaultFTSFieldConnective
public QueryOptions.Connective getDefaultFTSFieldConnective()
As getDefaultFTSConnective() but for field groups- Returns:
- the defaultFTSFieldConnective
-
setDefaultFTSFieldConnective
public void setDefaultFTSFieldConnective(QueryOptions.Connective defaultFTSFieldConnective)
As setDefaultFTSConnective() but for field groups- Parameters:
defaultFTSFieldConnective- the defaultFTSFieldConnective to set
-
getLocales
public List<Locale> getLocales()
Get the list of locales to use for the query- Returns:
- the locales
-
setLocales
public void setLocales(List<Locale> locales)
sSet the list of locales to use for the query- Parameters:
locales- the locales to set
-
getMlAnalaysisMode
public MLAnalysisMode getMlAnalaysisMode()
Get the mode for multi-lingual text analaysis- Returns:
- the mlAnalaysisMode
-
setMlAnalaysisMode
public void setMlAnalaysisMode(MLAnalysisMode mlAnalaysisMode)
Set the mode for multi-lingual text analaysis- Parameters:
mlAnalaysisMode- the mlAnalaysisMode to set
-
getQueryParameterDefinitions
public List<QueryParameterDefinition> getQueryParameterDefinitions()
Get the query parameters- Returns:
- the queryParameterDefinitions
-
setQueryParameterDefinitions
public void setQueryParameterDefinitions(List<QueryParameterDefinition> queryParameterDefinitions)
Set the query parameters- Parameters:
queryParameterDefinitions- the queryParameterDefinitions to set
-
isIncludeInTransactionData
public boolean isIncludeInTransactionData()
Does the search include any changes made in the current transaction?- Returns:
- the includeInTransactionData
-
setIncludeInTransactionData
public void setIncludeInTransactionData(boolean includeInTransactionData)
Set to true if the search include any changes made in the current transaction.- Parameters:
includeInTransactionData- the includeInTransactionData to set
-
getMaxPermissionCheckTimeMillis
public long getMaxPermissionCheckTimeMillis()
- Returns:
- the timeout in millis for permission checks
-
setMaxPermissionCheckTimeMillis
public void setMaxPermissionCheckTimeMillis(long maxPermissionCheckTimeMillis)
- Parameters:
maxPermissionCheckTimeMillis- - the timeout in millis for permission checks
-
getMaxPermissionChecks
public int getMaxPermissionChecks()
- Returns:
- the max number of permission checks to carry out
-
setMaxPermissionChecks
public void setMaxPermissionChecks(int maxPermissionChecks)
- Parameters:
maxPermissionChecks- - the max number of permission checks to carry out
-
getDefaultFieldName
public String getDefaultFieldName()
- Returns:
- the default field name
-
setDefaultFieldName
public void setDefaultFieldName(String defaultFieldName)
- Parameters:
defaultFieldName- - the default field name to use
-
getUseInMemorySort
public Boolean getUseInMemorySort()
- Returns:
- the useInMemorySort
-
setUseInMemorySort
public void setUseInMemorySort(Boolean useInMemorySort)
- Parameters:
useInMemorySort- the useInMemorySort to set
-
getMaxRawResultSetSizeForInMemorySort
public Integer getMaxRawResultSetSizeForInMemorySort()
- Returns:
- the maxRawResultSetSizeForInMemorySort
-
setMaxRawResultSetSizeForInMemorySort
public void setMaxRawResultSetSizeForInMemorySort(Integer maxRawResultSetSizeForInMemorySort)
- Parameters:
maxRawResultSetSizeForInMemorySort- the maxRawResultSetSizeForInMemorySort to set
-
isBulkFetchEnabled
public boolean isBulkFetchEnabled()
- Returns:
- true if bulk fetch is enabled
-
setBulkFetchEnabled
public void setBulkFetchEnabled(boolean isBulkFetchEnabled)
- Parameters:
isBulkFetchEnabled- boolean
-
getExcludeTenantFilter
public boolean getExcludeTenantFilter()
- Returns:
- the tenants
-
setExcludeTenantFilter
public void setExcludeTenantFilter(boolean excludeTenantFilter)
- Parameters:
excludeTenantFilter- boolean
-
getQueryConsistency
public QueryConsistency getQueryConsistency()
- Returns:
- the queryConsistency
-
setQueryConsistency
public void setQueryConsistency(QueryConsistency queryConsistency)
- Parameters:
queryConsistency- the queryConsistency to set
-
getSinceTxId
public Long getSinceTxId()
- Returns:
- the sinceTxId
-
setSinceTxId
public void setSinceTxId(Long sinceTxId)
- Parameters:
sinceTxId- the sinceTxId to set
-
getQueryTemplates
public Map<String,String> getQueryTemplates()
Get the query templates- Returns:
- - the query templates
-
addQueryTemplate
public String addQueryTemplate(String name, String template)
Add/replace a query template Not all languages support query templates- Parameters:
name- Stringtemplate- String- Returns:
- any removed template or null
-
getAsSearchParmeters
public SearchParameters getAsSearchParmeters()
- Returns:
- SearchParameters
-
-