io.sphere.sdk.search.model.FacetSearchModel Maven / Gradle / Ivy
package io.sphere.sdk.search.model;
import io.sphere.sdk.search.FilteredFacetExpression;
import io.sphere.sdk.search.TermFacetExpression;
import javax.annotation.Nullable;
/**
* Model to build facets.
* @param type of the resource
* @param type of the value
*/
public interface FacetSearchModel {
/**
* The alias related to the facet.
* @return the facet alias
*/
@Nullable
String getAlias();
/**
* Allows to set an alias to identify the facet.
* @param alias the identifier to use for the facet
* @return a new facet search model identical to the current one, but with the given alias
*/
FacetSearchModel withAlias(final String alias);
/**
* Generates an expression to obtain the facets of the attribute for all values.
* For example: a possible faceted classification could be ["red": 4, "yellow": 2, "blue": 1].
* @return a facet expression for all values
*/
TermFacetExpression allTerms();
/**
* Generates an expression to obtain the facet of the attribute for only the given value.
* For example: a possible faceted classification for "red" could be ["red": 4].
* @param value the value from which to obtain the facet
* @return a facet expression for only the given value
*/
FilteredFacetExpression onlyTerm(final V value);
/**
* Generates an expression to obtain the facets of the attribute for only the given values.
* For example: a possible faceted classification for ["red", "blue"] could be ["red": 4, "blue": 1].
* @param values the values from which to obtain the facets
* @return a facet expression for only the given values
*/
FilteredFacetExpression onlyTerm(final Iterable values);
/**
* Generates an expression to obtain the facets of the attribute for only the given values.
* For example: a possible faceted classification for ["red", "blue"] could be ["red": 4, "blue": 1].
* @param values the values from which to obtain the facets
* @return a facet expression for only the given values
*/
FilteredFacetExpression onlyTermAsString(final Iterable values);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy