Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products. If you have feedback or questions as you navigate the site, click Send Feedback.

QueryOptions (Google App Engine API for Java)

Stay organized with collections Save and categorize content based on your preferences.

Class QueryOptions

  • java.lang.Object

  • public final class QueryOptions
    extends java.lang.Object
    Represents options which control where and what in the search results to return, from restricting the document fields returned to those given, and scoring and sorting the results, whilst supporting pagination.

    For example, the following options will return documents from search results for some given query, returning up to 20 results including the fields 'author' and 'date-sent' as well as snippeted fields 'subject' and 'body'. The results are sorted by 'author' in descending order, getting the next 20 results from the responseCursor in the previously returned results, giving back a single cursor in the Results to get the next batch of results after this.

     QueryOptions request = QueryOptions.newBuilder()
          .setFieldsToReturn("author", "date-sent")
          .setFieldsToSnippet("subject", "body")

    • Method Detail

      • getLimit

        public int getLimit()
        the limit on the number of documents to return in search results
      • getCursor

        public Cursor getCursor()
        a cursor returned from a previous set of search results to use as a starting point to retrieve the next set of results. Can be null
      • getOffset

        public int getOffset()
        the offset of the first result to return; returns 0 if was not set
      • hasNumberFoundAccuracy

        public boolean hasNumberFoundAccuracy()
        Returns true iff there is an accuracy requirement set.
        the found count accuracy
      • getNumberFoundAccuracy

        public int getNumberFoundAccuracy()
        Any Results.getNumberFound() less than or equal to this setting will be accurate.
        the found count accuracy
      • isReturningIdsOnly

        public boolean isReturningIdsOnly()
        if this search request returns results document IDs only
      • getFieldsToReturn

        public java.util.List<java.lang.String> getFieldsToReturn()
        an unmodifiable list of names of fields to return in search results
      • getFieldsToSnippet

        public java.util.List<java.lang.String> getFieldsToSnippet()
        an unmodifiable list of names of fields to snippet in search results
      • getExpressionsToReturn

        public java.util.List<FieldExpression> getExpressionsToReturn()
        an unmodifiable list of expressions which will be evaluated and returned in results
      • newBuilder

        public static QueryOptions.Builder newBuilder(QueryOptions request)
        Creates a builder from the given request.
        request - the search request for the builder to use to build another request
        a new builder with values set from the given request
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object