QueryOptionsChecker (Google App Engine API for Java)

com.google.appengine.api.search.checkers

Class QueryOptionsChecker

  • java.lang.Object
    • com.google.appengine.api.search.checkers.QueryOptionsChecker


  • public final class QueryOptionsChecker
    extends java.lang.Object
    Checks values of QueryOptions.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.util.List<java.lang.String> checkFieldNames(java.util.List<java.lang.String> fieldNames)
      Checks that there are at most #MAXIMUM_NUMBER_OF_FIELDS_TO_RETURN field names and that each field name is valid.
      static int checkLimit(int limit)
      Checks whether the number of documents to return is between 1 and the maximum.
      static int checkNumberFoundAccuracy(int numberFoundAccuracy)
      Checks whether the minimum number of documents found accuracy is between 1 and the maximum.
      static java.lang.Integer checkOffset(java.lang.Integer offset)
      Checks whether the offset is between 0 and the maximum.
      static SearchParams checkValid(SearchParams params)
      Checks the search options are valid, specifically, has a non-null number of documents to return specification, a valid cursor if present, valid sort specification list, a valid collection of field names for sorting, and a valid scorer specification.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • QueryOptionsChecker

        public QueryOptionsChecker()
    • Method Detail

      • checkLimit

        public static int checkLimit(int limit)
        Checks whether the number of documents to return is between 1 and the maximum.
        Parameters:
        limit - the maximum number of documents to return in search results
        Returns:
        the checked number of documents to return
        Throws:
        java.lang.IllegalArgumentException - if the number of documents to return is out of range
      • checkOffset

        public static java.lang.Integer checkOffset(java.lang.Integer offset)
        Checks whether the offset is between 0 and the maximum. Can be null.
        Parameters:
        offset - the offset of the first result to return results
        Returns:
        the checked offset of the first result to return
        Throws:
        java.lang.IllegalArgumentException - if the offset is out of range
      • checkNumberFoundAccuracy

        public static int checkNumberFoundAccuracy(int numberFoundAccuracy)
        Checks whether the minimum number of documents found accuracy is between 1 and the maximum.
        Parameters:
        numberFoundAccuracy - the minimum number of documents found accuracy
        Returns:
        the checked accuracy
        Throws:
        java.lang.IllegalArgumentException - if the minimum is out of range
      • checkFieldNames

        public static java.util.List<java.lang.String> checkFieldNames(java.util.List<java.lang.String> fieldNames)
        Checks that there are at most #MAXIMUM_NUMBER_OF_FIELDS_TO_RETURN field names and that each field name is valid.
        Parameters:
        fieldNames - the list of field names to check
        Returns:
        the checked list of field names
        Throws:
        java.lang.IllegalArgumentException - if the field names list size exceeds the maximum, or some name is invalid
      • checkValid

        public static SearchParams checkValid(SearchParams params)
        Checks the search options are valid, specifically, has a non-null number of documents to return specification, a valid cursor if present, valid sort specification list, a valid collection of field names for sorting, and a valid scorer specification.
        Parameters:
        params - the SearchParams to check
        Returns:
        this checked SearchParams
        Throws:
        java.lang.IllegalArgumentException - if some part of the specification is invalid