Class SearchQuery
java.lang.Object
de.hybris.platform.solrfacetsearch.search.SearchQuery
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BackofficeSearchQuery
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic enumDeprecated.Since 5.7, query syntax should not rely on specific query parser. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSearchQuery(FacetSearchConfig facetSearchConfig, IndexedType indexedType) Deprecated.since 6.4, use any ofFacetSearchServicemethods for creating a search query. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBoost(BoostField boostField) voidaddBoost(String field, SearchQuery.QueryOperator queryOperator, Object value, Float boost, BoostField.BoostType boostType) voidaddBoostField(String field, String value, SearchQuery.Operator operator) Deprecated.Since 5.7, replaced byaddBoost(BoostField)voidAdds logically coupled query fields.voidaddExcludedItem(PK itemPk) voidaddFacet(FacetField facet) Adds a facet field.voidAdds a facet field.voidAdds a facet field.voidaddFacetValue(FacetValueField facetValue) Adds a facet value field.voidaddFacetValue(String field, String... values) Adds a facet value field.voidaddFacetValue(String field, Set<String> values) Adds a facet value field.voidAdds a field to the list of fields that will be returned within a query response.voidaddFilterQuery(QueryField query) Adds a filter query field.voidaddFilterQuery(String field, SearchQuery.Operator operator, String... values) Adds a filter query field.voidaddFilterQuery(String field, SearchQuery.Operator operator, Set<String> values) Adds a filter query field.voidaddFilterQuery(String field, String... values) Adds a filter query field.voidaddFilterRawQuery(RawQuery rawQuery) Adds a filter raw query using lucene syntax.voidaddFilterRawQuery(String rawQuery) Adds a filter raw query using lucene syntax.voidaddFreeTextFuzzyQuery(FreeTextFuzzyQueryField freeTextFuzzyQuery) Adds a free text fuzzy query field.voidaddFreeTextFuzzyQuery(String field, Integer minTermLength, Integer fuzziness, Float boost) Adds a free text fuzzy query field.voidaddFreeTextPhraseQuery(FreeTextPhraseQueryField freeTextPhraseQuery) Adds a free text phrase query field.voidaddFreeTextPhraseQuery(String field, Float slop, Float boost) Adds a free text phrase query field.voidaddFreeTextQuery(FreeTextQueryField freeTextQuery) Adds a free text query field.voidaddFreeTextQuery(String field, Integer minTermLength, Float boost) Adds a free text query field.voidaddFreeTextWildcardQuery(FreeTextWildcardQueryField freeTextWildcardQuery) Adds a free text wildcard query field.voidaddFreeTextWildcardQuery(String field, Integer minTermLength, WildcardType wildcardType, Float boost) Adds a free text wildcard query field.voidaddGroupCommand(GroupCommandField groupCommand) Deprecated, for removal: This API element is subject to removal in a future version.Replaced bysetGroupCommand(GroupCommandField).voidaddGroupCommand(String field) Deprecated, for removal: This API element is subject to removal in a future version.Replaced bysetGroupCommand(String).voidaddGroupCommand(String field, Integer groupLimit) Deprecated, for removal: This API element is subject to removal in a future version.Replaced bysetGroupCommand(String, Integer).voidaddHighlightingField(String highlightingField) Adds a field to the list of fields that will be used for highlighting the search term.protected final voidaddLegacySorts(SearchConfig searchConfig) voidaddPromotedItem(PK itemPk) voidaddQuery(QueryField query) Adds a query field.voidaddQuery(String field, SearchQuery.Operator operator, SearchQuery.QueryOperator queryOperator, String... values) Adds a query field.voidaddQuery(String field, SearchQuery.Operator operator, SearchQuery.QueryOperator queryOperator, Set<String> values) Adds a query field.voidaddQuery(String field, SearchQuery.Operator operator, String... values) Adds a query field.voidAdds a query field.voidaddRawParam(String param, String... values) Adds a new raw parameter.voidaddRawQuery(RawQuery rawQuery) Adds a raw query using lucene syntax.voidaddRawQuery(String rawQuery) Adds a raw query using lucene syntax.voidaddRawQuery(String rawQuery, SearchQuery.Operator operator) Deprecated.Since 5.7, seesetDefaultOperator(Operator).voidaddSort(OrderField sort) Adds a sort field.voidAdds a sort field using ascending as sort order.voidaddSort(String field, OrderField.SortOrder sortOrder) Adds a sort field.protected intfindBoostField(String name) protected intDeprecated.Since 5.7, replaced bygetRawQueries()Returns the catalog versions.Returns the currency.Returns the default operator for the search query.Returns the facet fields.Returns the facet search config.Returns the facet value fields.Returns the list of fields that will be returned within a query response.Returns the filter query fields.Returns the filter raw queries.Returns the free text fuzzy query fields.Returns the free text phrase query fields.Returns the free text query fields.Returns the query builder.Returns the query builder parameters.Returns the free text wildcard query fields.Returns the group command field.Deprecated, for removal: This API element is subject to removal in a future version.Replaced bygetGroupCommand().Returns the list of fields that will be used for highlighting search term.Returns the indexed type.Returns the keywords.Returns the language.intReturns the offset (page number).intReturns the page size.Returns the query fields.Returns the query contexts.Deprecated.Since 5.7, query syntax should not rely on specific query parser.Returns the raw parameters.Returns the raw queries.getSorts()Returns the sort fields.Returns the user query.booleanReturnstrueif spell checking is enabled for the search query.booleanReturnstrueif group facets is enabled for the search query.voidnextPage()Changes the offset to the next page.voidprevPage()Changes the offset to the previous page.voidsetCatalogVersions(List<CatalogVersionModel> catalogVersions) Sets the catalog versions.voidsetCurrency(String currency) Sets the currency.voidsetDefaultOperator(SearchQuery.Operator defaultOperator) Sets the default operator for the search query.voidsetEnableSpellcheck(boolean enableSpellcheck) Enables or disables spell checking for the search query.voidsetFreeTextQueryBuilder(String freeTextQueryBuilder) Sets the query builder.voidsetGroupCommand(GroupCommandField groupCommand) Sets the group command field.voidsetGroupCommand(String field) Sets the group command field.voidsetGroupCommand(String field, Integer groupLimit) Sets the group command field.voidsetGroupFacets(boolean groupFacets) Enables or disables group facets for the search query.voidsetKeywords(List<Keyword> keywords) Sets the keywords.voidsetLanguage(String language) Sets the language.voidsetNamedSort(String namedSort) voidsetOffset(int offset) Sets the offset (page number).voidsetPageSize(int pageSize) Sets the page size.voidsetQueryParser(SearchQuery.QueryParser queryParser) Deprecated.Since 5.7, query syntax should not rely on specific query parser.voidsetUserQuery(String userQuery) Sets the user query.
-
Field Details
-
ALL_FIELDS
- See Also:
-
-
Constructor Details
-
SearchQuery
@Deprecated(since="6.4") public SearchQuery(FacetSearchConfig facetSearchConfig, IndexedType indexedType) Deprecated.since 6.4, use any ofFacetSearchServicemethods for creating a search query.
-
-
Method Details
-
addLegacySorts
-
getQueryContexts
Returns the query contexts.- Returns:
- the queryContexts
-
getFacetSearchConfig
Returns the facet search config.- Returns:
- the facet search config
-
getIndexedType
Returns the indexed type.- Returns:
- the indexed type
-
getLanguage
Returns the language.- Returns:
- the language
-
setLanguage
Sets the language.- Parameters:
language- - isocode of the language
-
getCurrency
Returns the currency.- Returns:
- the currency
-
setCurrency
Sets the currency.- Parameters:
currency- - isocode of the currency
-
getCatalogVersions
Returns the catalog versions.- Returns:
- the catalog versions
-
setCatalogVersions
Sets the catalog versions.- Parameters:
catalogVersions- - the catalog versions
-
getOffset
public int getOffset()Returns the offset (page number). This is used for pagination.- Returns:
- the offset (page number)
-
setOffset
public void setOffset(int offset) Sets the offset (page number). This is used for pagination.- Parameters:
offset- the offset (page number)
-
getPageSize
public int getPageSize()Returns the page size. This is used for pagination.- Returns:
- the page size
-
setPageSize
public void setPageSize(int pageSize) Sets the page size. This is used for pagination.- Parameters:
pageSize- the page size
-
nextPage
public void nextPage()Changes the offset to the next page. Used for pagination. -
prevPage
public void prevPage()Changes the offset to the previous page. Used for pagination. -
getDefaultOperator
Returns the default operator for the search query.- Returns:
- the defaultOperator
-
setDefaultOperator
Sets the default operator for the search query.- Parameters:
defaultOperator- the default operator
-
addQuery
Adds a query field.- Parameters:
field- - the fieldvalues- - the values
-
addQuery
Adds a query field.- Parameters:
field- - the fieldoperator- - the operatorvalues- - the values
-
addQuery
public void addQuery(String field, SearchQuery.Operator operator, SearchQuery.QueryOperator queryOperator, String... values) Adds a query field.- Parameters:
field- - the fieldoperator- - the operatorqueryOperator- - the query operatorvalues- - the values
-
addQuery
public void addQuery(String field, SearchQuery.Operator operator, SearchQuery.QueryOperator queryOperator, Set<String> values) Adds a query field.- Parameters:
field- - the fieldoperator- - the operatorqueryOperator- - the query operatorvalues- - the values
-
addQuery
Adds a query field.- Parameters:
query- - the query field
-
getQueries
Returns the query fields.- Returns:
- the query fields
-
getFreeTextQueryBuilder
Returns the query builder.- Returns:
- the query builder
-
setFreeTextQueryBuilder
Sets the query builder.- Parameters:
freeTextQueryBuilder- - the query builder
-
getFreeTextQueryBuilderParameters
Returns the query builder parameters.- Returns:
- the query builder parameters
-
getUserQuery
Returns the user query.- Returns:
- the user query
-
setUserQuery
Sets the user query.- Parameters:
userQuery- - the user query
-
getKeywords
Returns the keywords.- Returns:
- the keywords
-
setKeywords
Sets the keywords.- Parameters:
keywords- - the keywords
-
addFreeTextQuery
Adds a free text query field.- Parameters:
field- - the fieldminTermLength- - minimal length of the search termboost- - the boost value
-
addFreeTextQuery
Adds a free text query field.- Parameters:
freeTextQuery- - the free text query field
-
getFreeTextQueries
Returns the free text query fields.- Returns:
- the free text query fields
-
addFreeTextFuzzyQuery
public void addFreeTextFuzzyQuery(String field, Integer minTermLength, Integer fuzziness, Float boost) Adds a free text fuzzy query field.- Parameters:
field- -the fieldminTermLength- - minimal length of the search termfuzziness- - the fuzziness valueboost- - the boost value
-
addFreeTextFuzzyQuery
Adds a free text fuzzy query field.- Parameters:
freeTextFuzzyQuery- -the free text fuzzy query field
-
getFreeTextFuzzyQueries
Returns the free text fuzzy query fields.- Returns:
- the free text fuzzy query fields
-
addFreeTextWildcardQuery
public void addFreeTextWildcardQuery(String field, Integer minTermLength, WildcardType wildcardType, Float boost) Adds a free text wildcard query field.- Parameters:
field- - the fieldminTermLength- - minimal length of the search termwildcardType- - the wildcard typeboost- - the boost value
-
addFreeTextWildcardQuery
Adds a free text wildcard query field.- Parameters:
freeTextWildcardQuery- -the free text wildcard query field
-
getFreeTextWildcardQueries
Returns the free text wildcard query fields.- Returns:
- the free text wildcard query fields
-
addFreeTextPhraseQuery
Adds a free text phrase query field.- Parameters:
field- - the fieldslop- - the slop valueboost- - the boost value
-
addFreeTextPhraseQuery
Adds a free text phrase query field.- Parameters:
freeTextPhraseQuery- - the free text phrase query field
-
getFreeTextPhraseQueries
Returns the free text phrase query fields.- Returns:
- the free text phrase query fields
-
addRawQuery
Adds a raw query using lucene syntax.- Parameters:
rawQuery- - the raw query
-
addRawQuery
Adds a raw query using lucene syntax.- Parameters:
rawQuery- - the raw query
-
getRawQueries
Returns the raw queries.- Returns:
- the raw queries
-
addFilterQuery
Adds a filter query field.- Parameters:
field- - the fieldvalues- - the values
-
addFilterQuery
Adds a filter query field.- Parameters:
field- - the fieldoperator- - the operatorvalues- - the values
-
addFilterQuery
Adds a filter query field.- Parameters:
field- - the fieldoperator- - the operatorvalues- - the values
-
addFilterQuery
Adds a filter query field.- Parameters:
query- - the filter query field
-
getFilterQueries
Returns the filter query fields.- Returns:
- the filter query fields
-
addFilterRawQuery
Adds a filter raw query using lucene syntax.- Parameters:
rawQuery- - the raw query
-
addFilterRawQuery
Adds a filter raw query using lucene syntax.- Parameters:
rawQuery- - the raw query
-
getFilterRawQueries
Returns the filter raw queries.- Returns:
- the filter raw queries
-
setGroupCommand
Sets the group command field.- Parameters:
field- - the group field
-
setGroupCommand
Sets the group command field.- Parameters:
field- - the group fieldgroupLimit- - the group limit
-
setGroupCommand
Sets the group command field.- Parameters:
groupCommand- - the group command field
-
getGroupCommand
Returns the group command field.- Returns:
- the group command fields
-
addGroupCommand
Deprecated, for removal: This API element is subject to removal in a future version.Replaced bysetGroupCommand(String).Adds group command field.- Parameters:
field- - the group field
-
addGroupCommand
@Deprecated(since="2105", forRemoval=true) public void addGroupCommand(String field, Integer groupLimit) Deprecated, for removal: This API element is subject to removal in a future version.Replaced bysetGroupCommand(String, Integer).Adds group command field.- Parameters:
field- - the group fieldgroupLimit- - the group limit
-
addGroupCommand
@Deprecated(since="2105", forRemoval=true) public void addGroupCommand(GroupCommandField groupCommand) Deprecated, for removal: This API element is subject to removal in a future version.Replaced bysetGroupCommand(GroupCommandField).Adds group command field.- Parameters:
groupCommand- - the group command field
-
getGroupCommands
Deprecated, for removal: This API element is subject to removal in a future version.Replaced bygetGroupCommand().Returns group command fields.- Returns:
- the group command fields
-
isGroupFacets
public boolean isGroupFacets()Returnstrueif group facets is enabled for the search query.- Returns:
trueif group facets is enabled,falseotherwise
-
setGroupFacets
public void setGroupFacets(boolean groupFacets) Enables or disables group facets for the search query.- Parameters:
groupFacets-trueto enable group facets,falseto disable it
-
addSort
Adds a sort field using ascending as sort order.- Parameters:
field- - the field
-
addSort
Adds a sort field.- Parameters:
field- - the fieldsortOrder- - the sort order
-
addSort
Adds a sort field.- Parameters:
sort- - the sort field
-
getSorts
Returns the sort fields.- Returns:
- the sort fields
-
addField
Adds a field to the list of fields that will be returned within a query response.- Parameters:
field- - the field
-
getFields
Returns the list of fields that will be returned within a query response.- Returns:
- the fields
-
addHighlightingField
Adds a field to the list of fields that will be used for highlighting the search term.- Parameters:
highlightingField- - the field used for highlighting.
-
getHighlightingFields
Returns the list of fields that will be used for highlighting search term.- Returns:
- the fields
-
addFacet
Adds a facet field.- Parameters:
field- - the field
-
addFacet
Adds a facet field.- Parameters:
field- - the fieldfacetType- - the facet type
-
addFacet
Adds a facet field.- Parameters:
facet- - the facet field
-
getFacets
Returns the facet fields.- Returns:
- the facet fields.
-
addFacetValue
Adds a facet value field.- Parameters:
field- - the fieldvalues- - the values
-
addFacetValue
Adds a facet value field.- Parameters:
field- - the fieldvalues- - the values
-
addFacetValue
Adds a facet value field.- Parameters:
facetValue- - the facet value field
-
getFacetValues
Returns the facet value fields.- Returns:
- the facet value fields.
-
addBoost
public void addBoost(String field, SearchQuery.QueryOperator queryOperator, Object value, Float boost, BoostField.BoostType boostType) -
addBoost
-
getBoosts
-
addPromotedItem
-
getPromotedItems
-
addExcludedItem
-
getExcludedItems
-
isEnableSpellcheck
public boolean isEnableSpellcheck()Returnstrueif spell checking is enabled for the search query.- Returns:
trueif spell checking is enabled,falseotherwise
-
setEnableSpellcheck
public void setEnableSpellcheck(boolean enableSpellcheck) Enables or disables spell checking for the search query.- Parameters:
enableSpellcheck-trueto enable spell checking,falseto disable it
-
addRawParam
Adds a new raw parameter.- Parameters:
param- - the parametervalues- - the values for the parameter
-
getRawParams
Returns the raw parameters.- Returns:
- the raw parameters
-
getBreadcrumbs
- Returns:
- the breadcrumbs
-
setQueryParser
Deprecated.Since 5.7, query syntax should not rely on specific query parser.Set custom QueryParser. If not set default query parser is used. -
getQueryParser
Deprecated.Since 5.7, query syntax should not rely on specific query parser.Get custom QueryParser.- Returns:
- QueryParser or null when it was not set.
-
addRawQuery
Deprecated.Since 5.7, seesetDefaultOperator(Operator).Adds a raw query using lucene syntax.- Parameters:
rawQuery- - the raw queryoperator- - the operator
-
addBoostField
@Deprecated(since="5.7") public void addBoostField(String field, String value, SearchQuery.Operator operator) Deprecated.Since 5.7, replaced byaddBoost(BoostField) -
getBoostFields
Deprecated.Since 5.7, replaced bygetRawQueries()- Returns:
- list of all boost fields
-
findField
-
findBoostField
-
addCoupledFields
Adds logically coupled query fields. -
getCoupledFields
- Returns:
- the coupledFields
-
getNamedSort
-
setNamedSort
-