Package com.loop54.model.request
Class SearchRequest
java.lang.Object
com.loop54.model.request.Request
com.loop54.model.request.ContentRequest
com.loop54.model.request.SearchRequest
This class is used to configure a search request to the Loop54 e-commerce search engine.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringThe search query from the end-user.Parameters for specifying how related queries should be retrieved.Parameters for specifying which related results to retrieve.Parameters for specifying which direct results to retrieve.Parameters for specifying how spelling suggestions should be retrieved.Fields inherited from class com.loop54.model.request.ContentRequest
contentResultsOptionsFields inherited from class com.loop54.model.request.Request
customData -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionwithContentResults(String entityType, Consumer<TypedEntityCollectionParameters> configurator) Chainable variant ofContentRequest.addContentResultsOptions(String): adds the options for a content entity type (or reuses the existing ones) and configures them, e.g.withCustomData(String key, Object value) Chainable variant ofRequest.addCustomData(String, Object).withRelatedQueries(Consumer<QueryCollectionParameters> configurator) ConfiguresrelatedQueriesOptions.withRelatedResults(Consumer<EntityCollectionParameters> configurator) ConfiguresrelatedResultsOptions.withResults(Consumer<EntityCollectionParameters> configurator) ConfiguresresultsOptions, e.g.withSpellingSuggestions(Consumer<QueryCollectionParameters> configurator) ConfiguresspellingSuggestionsOptions.Methods inherited from class com.loop54.model.request.ContentRequest
addContentResultsOptionsMethods inherited from class com.loop54.model.request.Request
addCustomData
-
Field Details
-
query
The search query from the end-user. Can at most be 200 chars long. -
resultsOptions
Parameters for specifying which direct results to retrieve. Such as filtering, faceting, sorting and paging. Only affects the direct results, to modify the related results userelatedResultsOptions. -
spellingSuggestionsOptions
Parameters for specifying how spelling suggestions should be retrieved. Contains paging and sorting options.
-
-
Constructor Details
-
SearchRequest
The search query from the end-user. Can at most be 200 chars long.- Parameters:
query- The query to search for.
-
-
Method Details
-
withResults
ConfiguresresultsOptions, e.g.request.withResults(r -> r.page(0, 20).distinctFacet("Category")).- Parameters:
configurator- Applied toresultsOptions.- Returns:
- This request, for chaining.
-
withRelatedResults
ConfiguresrelatedResultsOptions.- Parameters:
configurator- Applied torelatedResultsOptions.- Returns:
- This request, for chaining.
-
withSpellingSuggestions
ConfiguresspellingSuggestionsOptions.- Parameters:
configurator- Applied tospellingSuggestionsOptions.- Returns:
- This request, for chaining.
-
withRelatedQueries
ConfiguresrelatedQueriesOptions.- Parameters:
configurator- Applied torelatedQueriesOptions.- Returns:
- This request, for chaining.
-
withContentResults
public SearchRequest withContentResults(String entityType, Consumer<TypedEntityCollectionParameters> configurator) Description copied from class:ContentRequestChainable variant ofContentRequest.addContentResultsOptions(String): adds the options for a content entity type (or reuses the existing ones) and configures them, e.g.request.withContentResults("Brand", c -> c.page(0, 3)).- Overrides:
withContentResultsin classContentRequest- Parameters:
entityType- The content entity type to search, e.g. "Brand". Case-sensitive.configurator- Applied to the parameters of that content entity type.- Returns:
- This request, for chaining.
-
withCustomData
Description copied from class:RequestChainable variant ofRequest.addCustomData(String, Object). Subclasses override this to return their own type.- Overrides:
withCustomDatain classRequest- Parameters:
key- Key to set the data on. The keys will be treated as case-sensitive.value- Value to add to the custom data.- Returns:
- This request, for chaining.
-