code: public static <E extends Extension> IterableResult<E> appendSearchResults(IterableResult<E> previousSearchResult,
          IterableResult<E> result)
      {
          AggregatedIterableResult<E> newResult;
  
          if (previousSearchResult instanceof AggregatedIterableResult) {
              newResult = ((AggregatedIterableResult<E>) previousSearchResult);
          } else if (previousSearchResult != null) {
              newResult = new AggregatedIterableResult<>(previousSearchResult.getOffset());
              newResult.addSearchResult(previousSearchResult);
          } else {
              return result;
          }
  
          newResult.addSearchResult(result);
  
          return newResult;
      }
docs: Merge provided search results.
  
  @param previousSearchResult all the previous search results
  @param result the new search result to append
  @return the new aggregated search result
  @since 8.1M1
  @param <E> the type of element in the {@link Collection}