/*
 * Copyright 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// @exportToFramework:skipFile()
package androidx.appsearch.app;

import androidx.annotation.NonNull;

import com.google.common.util.concurrent.ListenableFuture;

import java.io.Closeable;
import java.util.List;

/**
 * SearchResults are a returned object from a query API.
 *
 * <p>Each {@link SearchResult} contains a document and may contain other fields like snippets
 * based on request.
 *
 * <p>Should close this object after finish fetching results.
 *
 * <p>This class is not thread safe.
 */
public interface SearchResults extends Closeable {
    /**
     * Gets a whole page of {@link SearchResult}s.
     *
     * <p>Re-call this method to get next page of {@link SearchResult}, until it returns an
     * empty list.
     *
     * <p>The page size is set by {@link SearchSpec.Builder#setResultCountPerPage}.
     *
     * @return The pending result of performing this operation.
     */
    @NonNull
    ListenableFuture<List<SearchResult>> getNextPage();

    @Override
    void close();
}

@@ -833,60 +833,50 @@
 %0A * 
-SearchResult
+Encapsulate
 s 
-a
 re
- a returned object from a query API
+sults of a search operation
 .%0A *
@@ -898,169 +898,392 @@
 ink 
+App
 Search
-Result%7D contains a document and may contain other fields like snippets%0A * based on request.%0A *%0A * %3Cp%3EShould close this object after finish fetching results
+Session#search%7D operation returns a list of %7B@link SearchResult%7D%0A * objects, referred to as a %22page%22, limited by the size configured by%0A * %7B@link SearchSpec.Builder#setResultCountPerPage%7D.%0A *%0A * %3Cp%3ETo fetch a page of results, call %7B@link #getNextPage()%7D.%0A *%0A * %3Cp%3EAll instances of %7B@link SearchResults%7D must call %7B@link SearchResults#close()%7D after the%0A * results are fetched
 .%0A *
@@ -1394,20 +1394,26 @@
   * 
-Gets a whole
+Retrieves the next
  pag
@@ -1437,16 +1437,23 @@
 hResult%7D
+ object
 s.%0A     
@@ -1468,69 +1468,152 @@
  %3Cp%3E
-Re-call this method to get next page of %7B@link SearchR
+The page size is configured by %7B@link SearchSpec.Builder#setResultCountPerPage%7D.%0A     *%0A     * %3Cp%3EContinue calling this method to access r
 esult
-%7D,
+s
  unt
@@ -1628,23 +1628,16 @@
 turns an
-%0A     *
  empty l
@@ -1643,170 +1643,167 @@
 list
-.%0A     *%0A     * %3Cp%3EThe page size is set by %7B@link SearchSpec.Builder#setResultCountPerPage%7D.%0A     *%0A     * @return The pending result of performing this operation
+,%0A     * signifying there are no more results.%0A     *%0A     * @return a %7B@link ListenableFuture%7D which resolves to a list of %7B@link SearchResult%7D%0A     * objects
 .%0A  

Update documentation for SearchResults