FacetRequest.Builder (Google App Engine API for Java)

com.google.appengine.api.search

Class FacetRequest.Builder

  • java.lang.Object
    • com.google.appengine.api.search.FacetRequest.Builder
  • Enclosing class:
    FacetRequest


    public static final class FacetRequest.Builder
    extends java.lang.Object
    A facet request builder. Each facet request should at least have the name of the facet. It can also includes number of values, a list of constraints on the values or a list of ranges for numeric facets. Note that the list of constraints and the list of ranges are mutually exclusive, i.e. you can specify one of them but not both.
    • Method Detail

      • addValueConstraint

        public FacetRequest.Builder addValueConstraint(java.lang.String constraint)
        Adds a value constraint to this facet request. Note that ranges and value constraints are mutually exclusive. Either of them can be provided, but not both for the same request.
        Returns:
        this Builder
        Throws:
        java.lang.IllegalArgumentException - if the constraint empty or longer than SearchApiLimits#FACET_MAXIMUM_VALUE_LENGTH.
        java.lang.IllegalStateException - if any number of ranges or SearchApiLimits.FACET_MAXIMUM_CONSTRAINTS constraints have already been added.
      • addRange

        public FacetRequest.Builder addRange(FacetRange range)
        Adds a FacetRange to this request. Note that ranges and value constraints are mutually exclusive. Either of them can be provided, but not both for the same request.
        Returns:
        this Builder
        Throws:
        java.lang.NullPointerException - if range is null.
        java.lang.IllegalStateException - if constraints list is not empty or number of ranges became greater than SearchApiLimits.FACET_MAXIMUM_RANGES by adding this range.
      • build

        public FacetRequest build()
        Construct the final message.
        Returns:
        the FacetRequest built from the parameters entered on this Builder
        Throws:
        java.lang.IllegalArgumentException - if the facet request is invalid

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

App Engine standard environment for Java