All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.client.SearchRequest Maven / Gradle / Ivy

There is a newer version: 0.72.1
Show newest version
package io.sphere.client;

import com.google.common.util.concurrent.ListenableFuture;
import io.sphere.client.facets.expressions.FacetExpression;
import io.sphere.client.filters.expressions.FilterExpression;
import io.sphere.client.model.SearchResult;

/** Request that uses a Sphere search API to fetch objects satisfying some conditions (including fulltext search)
 * and provide faceting functionality. Search is currently only supported for products. */
public interface SearchRequest {
    /** Executes the request and returns the result. */
    SearchResult fetch();

    /** Executes the request asynchronously and returns a future providing the result. */
    ListenableFuture> fetchAsync();

    /** Sets the page number for paging through results. Page numbers start at zero. */
    SearchRequest page(int page);

    /** Sets the size of a page for paging through results. When page size is not set, the default of 25 is used. */
    SearchRequest pageSize(int pageSize);

    /** Filters products by given constraints. */
    SearchRequest filter(FilterExpression filter, FilterExpression... filters);

    /** Filters products by given constraints. */
    SearchRequest filter(Iterable filters);

    /** Requests aggregated counts to be calculated for given facet expressions. */
    SearchRequest facet(FacetExpression facet, FacetExpression... facets);

    /** Requests aggregated counts to be calculated for given facet expressions. */
    SearchRequest facet(Iterable facets);

    /** Sorts products. When this method is not used, products are implicitly sorted by relevance.
     *
     * 

Example: {@code sort(ProductSort.price.asc)}. * * @param sort Specifies how products should be sorted. */ SearchRequest sort(ProductSort sort); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy