Class TypeAheadSuggestionConfiguration
java.lang.Object
com.broadleafcommerce.search.api.domain.TypeAheadSuggestionConfiguration
Represents a suggestion to be returned in a
TypeAheadResponse
.
For example, let's assume that in addition to text prediction, we want to return a set of the top 5 products with their name and price that relate to the suggestion terms.
A (shortened) configuration might look as follows:
{ "name": "products", "suggestionFields": [ { "fieldDefinition": { "id": "nameField", "label": "Name", "indexableType": "PRODUCT", "abbreviation": "name" }, "variantType": "TEXT" }, { "fieldDefinition": { "id": "priceField", "label": "Price", "indexableType": "PRODUCT", "abbreviation": "price" }, "variantType": "DOUBLE" }] "showResultCount": false, "faceted": false, "resultLimit": 5 }When doing a query for "iPhone", for instance, we would get back a result for a product in the following form, with up to 5 matching products:
"products": [ { "price": 619.0, "name": "iPhone 8 64GB (Silver)" }]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
getName()
The name to be displayed in the results.int
The maximum number of results to return for this configuration.The list of fields to be returned with this suggestion.int
hashCode()
boolean
Is this configuration faceted? Required for showing a result count.void
setFaceted
(boolean faceted) Is this configuration faceted? Required for showing a result count.void
The name to be displayed in the results.void
setResultLimit
(int resultLimit) The maximum number of results to return for this configuration.void
setSuggestionFields
(List<SuggestionField> suggestionFields) The list of fields to be returned with this suggestion.toString()
-
Constructor Details
-
TypeAheadSuggestionConfiguration
public TypeAheadSuggestionConfiguration()
-
-
Method Details
-
getName
The name to be displayed in the results. For instance, "Products". This may also be a translatable key.- Returns:
- The name to be displayed in the results
-
getSuggestionFields
The list of fields to be returned with this suggestion.- Returns:
- The list of fields to be returned with this suggestion
-
isFaceted
public boolean isFaceted()Is this configuration faceted? Required for showing a result count.Note that when a result is faceted, it can only be faceted on a single
SuggestionField
.- Returns:
- Is this configuration faceted?
-
getResultLimit
public int getResultLimit()The maximum number of results to return for this configuration.- Returns:
- The maximum number of results to return
-
setName
The name to be displayed in the results. For instance, "Products". This may also be a translatable key.- Parameters:
name
- The name to be displayed in the results
-
setSuggestionFields
The list of fields to be returned with this suggestion.- Parameters:
suggestionFields
- The list of fields to be returned with this suggestion
-
setFaceted
public void setFaceted(boolean faceted) Is this configuration faceted? Required for showing a result count.Note that when a result is faceted, it can only be faceted on a single
SuggestionField
.- Parameters:
faceted
- Is this configuration faceted?
-
setResultLimit
public void setResultLimit(int resultLimit) The maximum number of results to return for this configuration.- Parameters:
resultLimit
- The maximum number of results to return
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-