Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.service.cmr.search
Class SearchParameters
java.lang.Object
  org.alfresco.service.cmr.search.SearchParameters

public class SearchParameters
extends Object
This class provides parameters to define a search. TODO - paging of results page number and page size - paging isolation - REPEATABLE READ, READ COMMITTED, may SEE ONCE tracking node refs in previous result sets - how long repeatable read may be held - limit by the number of permission evaluations
Author:
Andy Hind

Field Summary
static String
ALTERNATIVE_DICTIONARY
          A parameter that can be passed to Solr to indicate an alternative dictionary should be used.
static org.alfresco.service.cmr.search.SearchParameters.Operator
AND
          AND
static org.alfresco.service.cmr.search.SearchParameters.Operator
OR
          OR
static org.alfresco.service.cmr.search.SearchParameters.SortDefinition
SORT_IN_DOCUMENT_ORDER_ASCENDING
          Sort in the order docs were added to the index - oldest docs first
static org.alfresco.service.cmr.search.SearchParameters.SortDefinition
SORT_IN_DOCUMENT_ORDER_DESCENDING
          Sort in the reverse order docs were added to the index - new/updateed docs first
static org.alfresco.service.cmr.search.SearchParameters.SortDefinition
SORT_IN_SCORE_ORDER_ASCENDING
          Sort in ascending score
static org.alfresco.service.cmr.search.SearchParameters.SortDefinition
SORT_IN_SCORE_ORDER_DESCENDING
          Sort in descending score order
Constructor Summary
SearchParameters()
          Default constructor
SearchParameters(org.alfresco.repo.search.impl.querymodel.QueryOptions options)
          Construct from Query Options
Method Summary
void
addAllAttribute(String attribute)
          Add a field for ALL expansion
void
addExtraParameter(String name, String value)
void
addFacetQuery(String facetQuery)
void
addFieldFacet(org.alfresco.service.cmr.search.SearchParameters.FieldFacet fieldFacet)
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
addQueryTemplate(String name, String template)
          Add/replace a query template Not all languages support query templates
void
addSort(org.alfresco.service.cmr.search.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
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.
getAllAttributes()
          Get the text attributes used for ALL expansion.
getDefaultFieldName()
org.alfresco.service.cmr.search.SearchParameters.Operator
getDefaultFTSFieldOperator()
          As getDefaultFTSConnective() but for field groups
org.alfresco.service.cmr.search.SearchParameters.Operator
getDefaultFTSOperator()
          Get the default connective used when OR and AND are not specified for the FTS contains() function.
org.alfresco.service.cmr.search.SearchParameters.Operator
getDefaultOperator()
          Get the default operator for query elements when they are not explicit in the query.
boolean
getExcludeTenantFilter()
getExtraParameters()
getFacetQueries()
List<org.alfresco.service.cmr.search.SearchParameters.FieldFacet>
getFieldFacets()
getLanguage()
          Get the search language
int
getLimit()
          If limiting the result set in some way, get the limiting value used.
getLimitBy()
          Get how the result set should be limited
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()
getMaxRawResultSetSizeForInMemorySort()
org.alfresco.repo.search.MLAnalysisMode
getMlAnalaysisMode()
          The way in which multilingual fields are treated durig a search.
getNamespace()
          Get the default namespace.
getPermissionEvaluation()
          Get when permissions are evaluated.
getQuery()
          Get the query.
org.alfresco.service.cmr.search.QueryConsistency
getQueryConsistency()
getQueryParameterDefinitions()
          Get the query parameters that apply to this query.
getQueryTemplates()
          Get the query templates
getSearchTerm()
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<org.alfresco.service.cmr.search.SearchParameters.SortDefinition>
getSortDefinitions()
          Get the sort definitions that apply to this query.
getSortLocale()
getStores()
          Get the stores in which this query should find results.
getTextAttributes()
          Get the text attributes used for text expansion.
getUseInMemorySort()
int
hashCode()
boolean
isBulkFetchEnabled()
boolean
isSpellCheck()
void
setBulkFetchEnabled(boolean isBulkFetchEnabled)
void
setDefaultFieldName(String defaultFieldName)
void
setDefaultFTSFieldConnective(org.alfresco.service.cmr.search.SearchParameters.Operator defaultFTSFieldOperator)
          As setDefaultFTSConnective() but for field groups
void
setDefaultFTSOperator(org.alfresco.service.cmr.search.SearchParameters.Operator defaultFTSOperator)
          Set the default connective used when OR and AND are not specified for the FTS contains() function.
void
setDefaultOperator(org.alfresco.service.cmr.search.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(org.alfresco.repo.search.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(org.alfresco.service.cmr.search.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)
toString()
boolean
usePostSort(int length, boolean useInMemorySortDefault, int maxRawResultSetSizeForInMemorySortDefault)
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Field Detail
ALTERNATIVE_DICTIONARY
public static final String ALTERNATIVE_DICTIONARY
A parameter that can be passed to Solr to indicate an alternative dictionary should be used.
See Also:
Constant Field Values

AND
public static final org.alfresco.service.cmr.search.SearchParameters.Operator AND
AND

OR
public static final org.alfresco.service.cmr.search.SearchParameters.Operator OR
OR

SORT_IN_DOCUMENT_ORDER_ASCENDING
public static final org.alfresco.service.cmr.search.SearchParameters.SortDefinition SORT_IN_DOCUMENT_ORDER_ASCENDING
Sort in the order docs were added to the index - oldest docs first

SORT_IN_DOCUMENT_ORDER_DESCENDING
public static final org.alfresco.service.cmr.search.SearchParameters.SortDefinition SORT_IN_DOCUMENT_ORDER_DESCENDING
Sort in the reverse order docs were added to the index - new/updateed docs first

SORT_IN_SCORE_ORDER_ASCENDING
public static final org.alfresco.service.cmr.search.SearchParameters.SortDefinition SORT_IN_SCORE_ORDER_ASCENDING
Sort in ascending score

SORT_IN_SCORE_ORDER_DESCENDING
public static final org.alfresco.service.cmr.search.SearchParameters.SortDefinition SORT_IN_SCORE_ORDER_DESCENDING
Sort in descending score order
Constructor Detail
SearchParameters
public SearchParameters()
Default constructor

SearchParameters
public SearchParameters(org.alfresco.repo.search.impl.querymodel.QueryOptions options)
Construct from Query Options
Parameters:
options - QueryOptions
Method Detail
copy
public SearchParameters copy()

getLanguage
public String getLanguage()
Get the search language
Returns:
- string id of search language

getQuery
public String getQuery()
Get the query.
Returns:
- the query string

setLanguage
public void setLanguage(String language)
Set the query language.
Parameters:
language - - the query language.

addExtraParameter
public void addExtraParameter(String name,
                              String value)

getExtraParameters
public Map<StringgetExtraParameters()

setQuery
public void setQuery(String query)
Set the query string.
Parameters:
query - - the query string.

addStore
public void addStore(StoreRef store)
Set the stores to be supported - currently there can be only one. Searching across multiple stores is on the todo list.
Parameters:
store - StoreRef

addQueryParameterDefinition
public void addQueryParameterDefinition(QueryParameterDefinition queryParameterDefinition)
Add parameter definitions for the query - used to parameterise the query string
Parameters:
queryParameterDefinition - QueryParameterDefinition

excludeDataInTheCurrentTransaction
public void excludeDataInTheCurrentTransaction(boolean excludeDataInTheCurrentTransaction)
If true, any data in the current transaction will be ignored in the search. You will not see anything you have added in the current transaction. By default you will see data in the current transaction. This effectively gives read committed isolation. There is a performance overhead for this, at least when using lucene. This flag may be set to avoid that performance hit if you know you do not want to find results that are yet to be committed (this includes creations, deletions and updates)
Parameters:
excludeDataInTheCurrentTransaction - boolean

addSort
public 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. A helper method to create SortDefinitions.
Parameters:
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.

addSort
public void addSort(org.alfresco.service.cmr.search.SearchParameters.SortDefinition sortDefinition)
Add a sort definition.
Parameters:
sortDefinition - - the sort definition to add. Use the static member variables for sorting in score and index order.

excludeDataInTheCurrentTransaction
public boolean excludeDataInTheCurrentTransaction()
Is data in the current transaction excluded from the search.
Returns:
- true if data in the current transaction is ignored

getQueryParameterDefinitions
public ArrayList<QueryParameterDefinitiongetQueryParameterDefinitions()
Get the query parameters that apply to this query.
Returns:
- the parameter

getSortDefinitions
public ArrayList<org.alfresco.service.cmr.search.SearchParameters.SortDefinition> getSortDefinitions()
Get the sort definitions that apply to this query.
Returns:
- the sort definitions

getStores
public ArrayList<StoreRefgetStores()
Get the stores in which this query should find results.
Returns:
- the list of stores

setDefaultOperator
public void setDefaultOperator(org.alfresco.service.cmr.search.SearchParameters.Operator defaultOperator)
Set the default operator for query elements when they are not explicit in the query.
Parameters:
defaultOperator - Operator

getDefaultOperator
public org.alfresco.service.cmr.search.SearchParameters.Operator getDefaultOperator()
Get the default operator for query elements when they are not explicit in the query.
Returns:
the default operator

getLimitBy
public LimitBy getLimitBy()
Get how the result set should be limited
Returns:
how the result set will be or was limited

setLimitBy
public void setLimitBy(LimitBy limitBy)
Set how the result set should be limited.
Parameters:
limitBy - LimitBy

getPermissionEvaluation
public PermissionEvaluationMode getPermissionEvaluation()
Get when permissions are evaluated.
Returns:
- how permissions are evaluated

setPermissionEvaluation
public void setPermissionEvaluation(PermissionEvaluationMode permissionEvaluation)
Set when permissions are evaluated.
Parameters:
permissionEvaluation - PermissionEvaluationMode

getLimit
public int getLimit()
If limiting the result set in some way, get the limiting value used.
Returns:
the limit

setLimit
public void setLimit(int limit)
If limiting the result set in some way, set the limiting value used.
Parameters:
limit - int

getMlAnalaysisMode
public org.alfresco.repo.search.MLAnalysisMode getMlAnalaysisMode()
The way in which multilingual fields are treated durig a search. By default, only the specified locale is used and it must be an exact match.
Returns:
- how locale related text is tokenised

setMlAnalaysisMode
public void setMlAnalaysisMode(org.alfresco.repo.search.MLAnalysisMode mlAnalaysisMode)
Set the way in which multilingual fields are treated durig a search. This controls in which locales an multilingual fields will match.
Parameters:
mlAnalaysisMode - MLAnalysisMode

addLocale
public void addLocale(Locale locale)
Add a locale to include for multi-lingual text searches. If non are set, the default is to use the user's locale.
Parameters:
locale - Locale

getLocales
public List<LocalegetLocales()
Get the locales used for multi-lingual text searches.
Returns:
- the locales

addTextAttribute
public void addTextAttribute(String attribute)
Add a field for TEXT expansion
Parameters:
attribute - - field/attribute in the index

getTextAttributes
public Set<StringgetTextAttributes()
Get the text attributes used for text expansion.
Returns:
the text attributes used for text expansion

addAllAttribute
public void addAllAttribute(String attribute)
Add a field for ALL expansion
Parameters:
attribute - - field/attribute in the index

getAllAttributes
public Set<StringgetAllAttributes()
Get the text attributes used for ALL expansion.
Returns:
the text attributes used for ALL expansion

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. A negative value implies unlimited 0 will return no results.
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

getDefaultFTSOperator
public org.alfresco.service.cmr.search.SearchParameters.Operator getDefaultFTSOperator()
Get the default connective used when OR and AND are not specified for the FTS contains() function.
Returns:
the defaultFTSConnective

setDefaultFTSOperator
public void setDefaultFTSOperator(org.alfresco.service.cmr.search.SearchParameters.Operator defaultFTSOperator)
Set the default connective used when OR and AND are not specified for the FTS contains() function.
Parameters:
defaultFTSOperator - the defaultFTSOperator to set

getDefaultFTSFieldOperator
public org.alfresco.service.cmr.search.SearchParameters.Operator getDefaultFTSFieldOperator()
As getDefaultFTSConnective() but for field groups
Returns:
the defaultFTSFieldConnective

setDefaultFTSFieldConnective
public void setDefaultFTSFieldConnective(org.alfresco.service.cmr.search.SearchParameters.Operator defaultFTSFieldOperator)
As setDefaultFTSConnective() but for field groups
Parameters:
defaultFTSFieldOperator - the defaultFTSFieldOperator to set

getNamespace
public String getNamespace()
Get the default namespace.
Returns:
the default namspace uri or prefix.

setNamespace
public void setNamespace(String namespace)
Set the default namespace
Parameters:
namespace - - the uri or prefix for the default namespace.

getQueryTemplates
public Map<StringgetQueryTemplates()
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 - String
template - String
Returns:
any removed template or null

getMaxPermissionCheckTimeMillis
public long getMaxPermissionCheckTimeMillis()

setMaxPermissionCheckTimeMillis
public void setMaxPermissionCheckTimeMillis(long maxPermissionCheckTimeMillis)

getMaxPermissionChecks
public int getMaxPermissionChecks()

setMaxPermissionChecks
public void setMaxPermissionChecks(int maxPermissionChecks)

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

getDefaultFieldName
public String getDefaultFieldName()
Returns:
the default field name

setDefaultFieldName
public void setDefaultFieldName(String defaultFieldName)
Parameters:
defaultFieldName - - the default field name to use

getFieldFacets
public List<org.alfresco.service.cmr.search.SearchParameters.FieldFacet> getFieldFacets()

addFieldFacet
public void addFieldFacet(org.alfresco.service.cmr.search.SearchParameters.FieldFacet fieldFacet)

getFacetQueries
public List<StringgetFacetQueries()

addFacetQuery
public void addFacetQuery(String facetQuery)

getSortLocale
public Locale getSortLocale()

setExcludeTenantFilter
public void setExcludeTenantFilter(boolean excludeTenantFilter)

getExcludeTenantFilter
public boolean getExcludeTenantFilter()

setQueryConsistency
public void setQueryConsistency(org.alfresco.service.cmr.search.QueryConsistency queryConsistency)

getQueryConsistency
public org.alfresco.service.cmr.search.QueryConsistency getQueryConsistency()
Returns:
the queryConsistency

getSinceTxId
public Long getSinceTxId()
If not null, then the search should only include results from transactions after sinceTxId.
Returns:
sinceTxId

setSinceTxId
public void setSinceTxId(Long sinceTxId)
If not null, then the search should only include results from transactions after sinceTxId.
Parameters:
sinceTxId - Long

getSearchTerm
public String getSearchTerm()
Returns:
the searchTerm

setSearchTerm
public void setSearchTerm(String searchTerm)
Parameters:
searchTerm - the searchTerm to set

isSpellCheck
public boolean isSpellCheck()
Returns:
the spellCheck

setSpellCheck
public void setSpellCheck(boolean spellCheck)
Parameters:
spellCheck - the spellCheck to set

hashCode
public int hashCode()
Overrides:
hashCode in class Object

equals
public boolean equals(Object obj)
Overrides:
equals in class Object

toString
public String toString()
Overrides:
toString in class Object

usePostSort
public boolean usePostSort(int length,
                           boolean useInMemorySortDefault,
                           int maxRawResultSetSizeForInMemorySortDefault)
Parameters:
length - int
useInMemorySortDefault - boolean
maxRawResultSetSizeForInMemorySortDefault - int
Returns:
boolean

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2016 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.