@AlfrescoPublicApi public class SearchParameters extends Object implements BasicSearchParameters
Modifier and Type | Class and Description |
---|---|
static class |
SearchParameters.FieldFacet |
static class |
SearchParameters.FieldFacetMethod |
static class |
SearchParameters.FieldFacetSort |
static class |
SearchParameters.Operator
An emum defining if the default action is to "and" or "or" unspecified components in the query register.
|
static class |
SearchParameters.SortDefinition
A helper class for sort definition.
|
Modifier and Type | Field and Description |
---|---|
static String |
ALTERNATIVE_DICTIONARY
A parameter that can be passed to Solr to indicate an alternative dictionary should be used.
|
static SearchParameters.Operator |
AND
AND
|
static SearchParameters.Operator |
OR
OR
|
static SearchParameters.SortDefinition |
SORT_IN_DOCUMENT_ORDER_ASCENDING
Sort in the order docs were added to the index - oldest docs first
|
static SearchParameters.SortDefinition |
SORT_IN_DOCUMENT_ORDER_DESCENDING
Sort in the reverse order docs were added to the index - new/updateed docs first
|
static SearchParameters.SortDefinition |
SORT_IN_SCORE_ORDER_ASCENDING
Sort in ascending score
|
static SearchParameters.SortDefinition |
SORT_IN_SCORE_ORDER_DESCENDING
Sort in descending score order
|
Constructor and Description |
---|
SearchParameters()
Default constructor
|
SearchParameters(QueryOptions options)
Construct from Query Options
|
Modifier and Type | Method and Description |
---|---|
void |
addAllAttribute(String attribute)
Add a field for ALL expansion
|
void |
addExtraParameter(String name,
String value) |
void |
addFacetQuery(String facetQuery) |
void |
addFieldFacet(SearchParameters.FieldFacet fieldFacet) |
void |
addFilterQuery(String filterQuery) |
void |
addLocale(Locale locale)
Add a locale to include for multi-lingual text searches.
|
void |
addQueryParameterDefinition(QueryParameterDefinition queryParameterDefinition)
Add parameter definitions for the query - used to parameterise the query string
|
String |
addQueryTemplate(String name,
String template)
Add/replace a query template Not all languages support query templates
|
void |
addSort(SearchParameters.SortDefinition sortDefinition)
Add a sort definition.
|
void |
addSort(String field,
boolean ascending)
Add a sort to the query (for those query languages that do not support it directly) The first sort added is
treated as primary, the second as secondary etc.
|
void |
addStore(StoreRef store)
Set the stores to be supported - currently there can be only one.
|
void |
addTextAttribute(String attribute)
Add a field for TEXT expansion
|
SearchParameters |
copy() |
boolean |
equals(Object obj) |
boolean |
excludeDataInTheCurrentTransaction()
Is data in the current transaction excluded from the search.
|
void |
excludeDataInTheCurrentTransaction(boolean excludeDataInTheCurrentTransaction)
If true, any data in the current transaction will be ignored in the search.
|
Set<String> |
getAllAttributes()
Get the text attributes used for ALL expansion.
|
String |
getDefaultFieldName() |
SearchParameters.Operator |
getDefaultFTSFieldOperator()
As getDefaultFTSConnective() but for field groups
|
SearchParameters.Operator |
getDefaultFTSOperator()
Get the default connective used when OR and AND are not specified for the FTS contains() function.
|
SearchParameters.Operator |
getDefaultOperator()
Get the default operator for query elements when they are not explicit in the query.
|
boolean |
getExcludeTenantFilter() |
Map<String,String> |
getExtraParameters() |
List<String> |
getFacetQueries() |
List<SearchParameters.FieldFacet> |
getFieldFacets() |
List<String> |
getFilterQueries() |
String |
getLanguage()
Get the search language
|
int |
getLimit()
If limiting the result set in some way, get the limiting value used.
|
LimitBy |
getLimitBy()
Get how the result set should be limited
|
List<Locale> |
getLocales()
Get the locales used for multi-lingual text searches.
|
int |
getMaxItems()
Get the max number of rows for the result set 0 or less is unlimited
|
int |
getMaxPermissionChecks() |
long |
getMaxPermissionCheckTimeMillis() |
Integer |
getMaxRawResultSetSizeForInMemorySort() |
MLAnalysisMode |
getMlAnalaysisMode()
The way in which multilingual fields are treated durig a search.
|
String |
getNamespace()
Get the default namespace.
|
PermissionEvaluationMode |
getPermissionEvaluation()
Get when permissions are evaluated.
|
String |
getQuery()
Get the query.
|
QueryConsistency |
getQueryConsistency() |
ArrayList<QueryParameterDefinition> |
getQueryParameterDefinitions()
Get the query parameters that apply to this query.
|
Map<String,String> |
getQueryTemplates()
Get the query templates
|
String |
getSearchTerm() |
Long |
getSinceTxId()
If not null, then the search should only include results from transactions after
sinceTxId . |
int |
getSkipCount()
Get the skip count - the number of rows to skip at the start of the query.
|
ArrayList<SearchParameters.SortDefinition> |
getSortDefinitions()
Get the sort definitions that apply to this query.
|
Locale |
getSortLocale() |
ArrayList<StoreRef> |
getStores()
Get the stores in which this query should find results.
|
Set<String> |
getTextAttributes()
Get the text attributes used for text expansion.
|
Boolean |
getUseInMemorySort() |
int |
hashCode() |
boolean |
isBulkFetchEnabled() |
boolean |
isSpellCheck() |
void |
setBulkFetchEnabled(boolean isBulkFetchEnabled) |
void |
setDefaultFieldName(String defaultFieldName) |
void |
setDefaultFTSFieldConnective(SearchParameters.Operator defaultFTSFieldOperator)
As setDefaultFTSConnective() but for field groups
|
void |
setDefaultFTSOperator(SearchParameters.Operator defaultFTSOperator)
Set the default connective used when OR and AND are not specified for the FTS contains() function.
|
void |
setDefaultOperator(SearchParameters.Operator defaultOperator)
Set the default operator for query elements when they are not explicit in the query.
|
void |
setExcludeTenantFilter(boolean excludeTenantFilter) |
void |
setLanguage(String language)
Set the query language.
|
void |
setLimit(int limit)
If limiting the result set in some way, set the limiting value used.
|
void |
setLimitBy(LimitBy limitBy)
Set how the result set should be limited.
|
void |
setMaxItems(int maxItems)
Set the max number of rows for the result set.
|
void |
setMaxPermissionChecks(int maxPermissionChecks) |
void |
setMaxPermissionCheckTimeMillis(long maxPermissionCheckTimeMillis) |
void |
setMaxRawResultSetSizeForInMemorySort(Integer maxRawResultSetSizeForInMemorySort) |
void |
setMlAnalaysisMode(MLAnalysisMode mlAnalaysisMode)
Set the way in which multilingual fields are treated durig a search.
|
void |
setNamespace(String namespace)
Set the default namespace
|
void |
setPermissionEvaluation(PermissionEvaluationMode permissionEvaluation)
Set when permissions are evaluated.
|
void |
setQuery(String query)
Set the query string.
|
void |
setQueryConsistency(QueryConsistency queryConsistency) |
void |
setSearchTerm(String searchTerm) |
void |
setSinceTxId(Long sinceTxId)
If not null, then the search should only include results from transactions after
sinceTxId . |
void |
setSkipCount(int skipCount)
Set the skip count - the number of rows to skip at the start of the query.
|
void |
setSpellCheck(boolean spellCheck) |
void |
setUseInMemorySort(Boolean useInMemorySort) |
String |
toString() |
boolean |
usePostSort(int length,
boolean useInMemorySortDefault,
int maxRawResultSetSizeForInMemorySortDefault) |
public static final SearchParameters.SortDefinition SORT_IN_DOCUMENT_ORDER_ASCENDING
public static final SearchParameters.SortDefinition SORT_IN_DOCUMENT_ORDER_DESCENDING
public static final SearchParameters.SortDefinition SORT_IN_SCORE_ORDER_ASCENDING
public static final SearchParameters.SortDefinition SORT_IN_SCORE_ORDER_DESCENDING
public static final SearchParameters.Operator OR
public static final SearchParameters.Operator AND
public static final String ALTERNATIVE_DICTIONARY
public SearchParameters()
public SearchParameters(QueryOptions options)
options
- QueryOptionspublic SearchParameters copy()
public String getLanguage()
getLanguage
in interface BasicSearchParameters
public String getQuery()
getQuery
in interface BasicSearchParameters
public void setLanguage(String language)
language
- -
the query language.public void setQuery(String query)
query
- -
the query string.public void addStore(StoreRef store)
store
- StoreRefpublic void addQueryParameterDefinition(QueryParameterDefinition queryParameterDefinition)
queryParameterDefinition
- QueryParameterDefinitionpublic void excludeDataInTheCurrentTransaction(boolean excludeDataInTheCurrentTransaction)
excludeDataInTheCurrentTransaction
- booleanpublic void addSort(String field, boolean ascending)
field
- -
this is initially a direct attribute on a node not an attribute on the parent etc TODO: It could be a
relative path at some time.ascending
- -
true to sort ascending, false for descending.public void addSort(SearchParameters.SortDefinition sortDefinition)
sortDefinition
- -
the sort definition to add. Use the static member variables for sorting in score and index order.public boolean excludeDataInTheCurrentTransaction()
public ArrayList<QueryParameterDefinition> getQueryParameterDefinitions()
public ArrayList<SearchParameters.SortDefinition> getSortDefinitions()
getSortDefinitions
in interface BasicSearchParameters
public ArrayList<StoreRef> getStores()
getStores
in interface BasicSearchParameters
public void setDefaultOperator(SearchParameters.Operator defaultOperator)
defaultOperator
- Operatorpublic SearchParameters.Operator getDefaultOperator()
public LimitBy getLimitBy()
public void setLimitBy(LimitBy limitBy)
limitBy
- LimitBypublic PermissionEvaluationMode getPermissionEvaluation()
public void setPermissionEvaluation(PermissionEvaluationMode permissionEvaluation)
permissionEvaluation
- PermissionEvaluationModepublic int getLimit()
public void setLimit(int limit)
limit
- intpublic MLAnalysisMode getMlAnalaysisMode()
public void setMlAnalaysisMode(MLAnalysisMode mlAnalaysisMode)
mlAnalaysisMode
- MLAnalysisModepublic void addLocale(Locale locale)
locale
- Localepublic List<Locale> getLocales()
getLocales
in interface BasicSearchParameters
public void addTextAttribute(String attribute)
attribute
- -
field/attribute in the indexpublic Set<String> getTextAttributes()
public void addAllAttribute(String attribute)
attribute
- -
field/attribute in the indexpublic Set<String> getAllAttributes()
public int getMaxItems()
public void setMaxItems(int maxItems)
maxItems
- the maxItems to setpublic int getSkipCount()
public void setSkipCount(int skipCount)
skipCount
- the skipCount to setpublic SearchParameters.Operator getDefaultFTSOperator()
public void setDefaultFTSOperator(SearchParameters.Operator defaultFTSOperator)
defaultFTSOperator
- the defaultFTSOperator to setpublic SearchParameters.Operator getDefaultFTSFieldOperator()
public void setDefaultFTSFieldConnective(SearchParameters.Operator defaultFTSFieldOperator)
defaultFTSFieldOperator
- the defaultFTSFieldOperator to setpublic String getNamespace()
public void setNamespace(String namespace)
namespace
- -
the uri or prefix for the default namespace.public Map<String,String> getQueryTemplates()
public String addQueryTemplate(String name, String template)
name
- Stringtemplate
- Stringpublic long getMaxPermissionCheckTimeMillis()
public void setMaxPermissionCheckTimeMillis(long maxPermissionCheckTimeMillis)
public int getMaxPermissionChecks()
public void setMaxPermissionChecks(int maxPermissionChecks)
public Boolean getUseInMemorySort()
public void setUseInMemorySort(Boolean useInMemorySort)
useInMemorySort
- the useInMemorySort to setpublic Integer getMaxRawResultSetSizeForInMemorySort()
public void setMaxRawResultSetSizeForInMemorySort(Integer maxRawResultSetSizeForInMemorySort)
maxRawResultSetSizeForInMemorySort
- the maxRawResultSetSizeForInMemorySort to setpublic boolean isBulkFetchEnabled()
public void setBulkFetchEnabled(boolean isBulkFetchEnabled)
isBulkFetchEnabled
- booleanpublic String getDefaultFieldName()
public void setDefaultFieldName(String defaultFieldName)
defaultFieldName
- - the default field name to usepublic List<SearchParameters.FieldFacet> getFieldFacets()
public void addFieldFacet(SearchParameters.FieldFacet fieldFacet)
public void addFacetQuery(String facetQuery)
public void addFilterQuery(String filterQuery)
public Locale getSortLocale()
public void setExcludeTenantFilter(boolean excludeTenantFilter)
public boolean getExcludeTenantFilter()
public void setQueryConsistency(QueryConsistency queryConsistency)
public QueryConsistency getQueryConsistency()
public Long getSinceTxId()
sinceTxId
.public void setSinceTxId(Long sinceTxId)
sinceTxId
.sinceTxId
- Longpublic String getSearchTerm()
public void setSearchTerm(String searchTerm)
searchTerm
- the searchTerm to setpublic boolean isSpellCheck()
public void setSpellCheck(boolean spellCheck)
spellCheck
- the spellCheck to setpublic boolean usePostSort(int length, boolean useInMemorySortDefault, int maxRawResultSetSizeForInMemorySortDefault)
length
- intuseInMemorySortDefault
- booleanmaxRawResultSetSizeForInMemorySortDefault
- intCopyright © 2005–2016 Alfresco Software. All rights reserved.