Class SimpleQuery
java.lang.Object
org.springframework.data.solr.core.query.SimpleQuery
- All Implemented Interfaces:
FilterQuery,Query,SolrDataQuery
- Direct Known Subclasses:
SimpleFacetAndHighlightQuery,SimpleFacetQuery,SimpleHighlightQuery
Full implementation of
Query that allows multiple options like pagination, grouping,...-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.solr.core.query.Query
Query.Operator -
Field Summary
Fields inherited from interface org.springframework.data.solr.core.query.Query
DEFAULT_PAGE_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionSimpleQuery(String queryString) SimpleQuery(String queryString, org.springframework.data.domain.Pageable pageable) SimpleQuery(Criteria criteria) SimpleQuery(Criteria criteria, org.springframework.data.domain.Pageable pageable) -
Method Summary
Modifier and TypeMethodDescriptionfinal <T extends SolrDataQuery>
TaddCriteria(Criteria criteria) Add an criteria to the query.<T extends Query>
TaddFilterQuery(FilterQuery filterQuery) add query to filter results Corresponds tofqin solrfinal <T extends Query>
TaddGroupByField(String fieldname) Deprecated.final <T extends Query>
TaddGroupByField(Field field) Deprecated.final <T extends Query>
TaddProjectionOnField(String fieldname) final <T extends Query>
TaddProjectionOnField(Field field) add given Field to those included in result.final <T extends Query>
TaddProjectionOnFields(String... fieldnames) final <T extends Query>
TaddProjectionOnFields(Field... fields) final <T extends Query>
TaddSort(org.springframework.data.domain.Sort sort) AddSortto querystatic final Querystatic <T extends SimpleQuery>
TGet the specified default operator for query expressions, overriding the default operator specified in theschema.xmlfile.Get the default type of query, if one has been specified.Get filter queries if definedDeprecated.getJoin()Get number of rows to skip.org.springframework.data.domain.PageableGet page settings if defined.Get projection fields if definedgetRows()Get number of rows to fetch.org.springframework.data.domain.SortgetSort()Return the time (in milliseconds) allowed for a search to finishbooleanvoidsetDefaultOperator(Query.Operator operator) Set the default operatorq.opfor query expressionsvoidsetDefType(String defType) Sets the default type to be used by the query.<T extends Query>
TsetGroupOptions(GroupOptions groupOptions) SetsGroupOptionsfor thisQuery.voidSet values for join!join from=inner_id to=outer_id<T extends Query>
TSet the number of rows to skip.final <T extends Query>
TsetPageRequest(org.springframework.data.domain.Pageable pageable) restrict result to entries on given page.voidsetRequestHandler(String requestHandler) <T extends Query>
TSet the number of rows to fetch.<T extends Query>
TsetSpellcheckOptions(SpellcheckOptions spellcheckOptions) Set theSpellcheckOptionsto enable spellchecking.<T extends Query>
TsetStatsOptions(StatsOptions statsOptions) SetStatsOptionsfor thisQuery.<T extends Query>
TsetTimeAllowed(Integer timeAllowed) The time in milliseconds allowed for a search to finish.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.solr.core.query.Query
getRequestHandler, projectAllFields, setRequestHandlerMethods inherited from interface org.springframework.data.solr.core.query.SolrDataQuery
addCriteria, getCriteria, getJoin, setJoin
-
Constructor Details
-
SimpleQuery
public SimpleQuery() -
SimpleQuery
- Parameters:
criteria-
-
SimpleQuery
- Parameters:
queryString-- Since:
- 1.1
-
SimpleQuery
- Parameters:
criteria-pageable-
-
SimpleQuery
- Parameters:
queryString-pageable-- Since:
- 1.1
-
-
Method Details
-
fromQuery
-
fromQuery
@Nullable public static <T extends SimpleQuery> T fromQuery(@Nullable Query source, @Nullable T destination) -
addProjectionOnField
Description copied from interface:Queryadd given Field to those included in result. Corresponds to theflparameter in solr.- Specified by:
addProjectionOnFieldin interfaceQuery- Returns:
-
addProjectionOnField
-
addProjectionOnFields
-
addProjectionOnFields
-
setPageRequest
Description copied from interface:Queryrestrict result to entries on given page. Corresponds to thestartandrowparameter in solr- Specified by:
setPageRequestin interfaceQuery- Returns:
-
setOffset
Description copied from interface:QuerySet the number of rows to skip. -
setRows
Description copied from interface:QuerySet the number of rows to fetch. -
addGroupByField
Deprecated.Description copied from interface:Queryadd the given field to those used for grouping result Corresponds to '' in solr- Specified by:
addGroupByFieldin interfaceQuery- Returns:
-
addGroupByField
Deprecated.in favor ofGroupOptionsadd grouping on field name- Parameters:
fieldname- must not be null- Returns:
- See Also:
-
addSort
Description copied from interface:QueryAddSortto query -
getSort
public org.springframework.data.domain.Sort getSort() -
getPageRequest
public org.springframework.data.domain.Pageable getPageRequest()Description copied from interface:QueryGet page settings if defined.- Specified by:
getPageRequestin interfaceQuery- Returns:
-
getOffset
Description copied from interface:QueryGet number of rows to skip. -
getRows
Description copied from interface:QueryGet number of rows to fetch. -
getGroupByFields
Deprecated.Description copied from interface:QueryGet group by fields if defined- Specified by:
getGroupByFieldsin interfaceQuery- Returns:
-
getProjectionOnFields
Description copied from interface:QueryGet projection fields if defined- Specified by:
getProjectionOnFieldsin interfaceQuery- Returns:
-
addFilterQuery
Description copied from interface:Queryadd query to filter results Corresponds tofqin solr- Specified by:
addFilterQueryin interfaceQuery- Returns:
-
setTimeAllowed
Description copied from interface:QueryThe time in milliseconds allowed for a search to finish. Values<= 0mean no time restriction.- Specified by:
setTimeAllowedin interfaceQuery- Returns:
-
getTimeAllowed
Description copied from interface:QueryReturn the time (in milliseconds) allowed for a search to finish- Specified by:
getTimeAllowedin interfaceQuery- Returns:
-
setGroupOptions
Description copied from interface:QuerySetsGroupOptionsfor thisQuery.- Specified by:
setGroupOptionsin interfaceQuery- Returns:
-
getGroupOptions
- Specified by:
getGroupOptionsin interfaceQuery- Returns:
- group options
-
getStatsOptions
- Specified by:
getStatsOptionsin interfaceQuery- Returns:
StatsOptionsor null if not set.
-
setStatsOptions
Description copied from interface:QuerySetStatsOptionsfor thisQuery.- Specified by:
setStatsOptionsin interfaceQuery- Returns:
-
getFilterQueries
Description copied from interface:QueryGet filter queries if defined- Specified by:
getFilterQueriesin interfaceQuery- Returns:
-
getDefaultOperator
Description copied from interface:QueryGet the specified default operator for query expressions, overriding the default operator specified in theschema.xmlfile.- Specified by:
getDefaultOperatorin interfaceQuery- Returns:
-
hasDefaultOperatorDefined
public boolean hasDefaultOperatorDefined()- Returns:
- true if current operator does not equal
Query.Operator.NONE
-
setDefaultOperator
Description copied from interface:QuerySet the default operatorq.opfor query expressions- Specified by:
setDefaultOperatorin interfaceQuery
-
getDefType
Description copied from interface:QueryGet the default type of query, if one has been specified. Overrides the default type specified in the solrconfig.xml file.- Specified by:
getDefTypein interfaceQuery- Returns:
-
setDefType
Description copied from interface:QuerySets the default type to be used by the query.- Specified by:
setDefTypein interfaceQuery
-
setSpellcheckOptions
Description copied from interface:QuerySet theSpellcheckOptionsto enable spellchecking.- Specified by:
setSpellcheckOptionsin interfaceQuery- Parameters:
spellcheckOptions- can be null.- Returns:
- never null.
-
getSpellcheckOptions
- Specified by:
getSpellcheckOptionsin interfaceQuery- Returns:
- null if not set.
-
addCriteria
Add an criteria to the query. The criteria will be connected using 'AND'.- Parameters:
criteria- must not be null.- Returns:
-
getCriteria
- Returns:
- null if not set
-
setJoin
Set values for join!join from=inner_id to=outer_id -
getJoin
- Returns:
- null if not set
-
getRequestHandler
-
setRequestHandler
-
GroupOptions