code: public static IterableResult<Extension> search(ExtensionQuery query, Iterable<ExtensionRepository> repositories)
          throws SearchException
      {
          IterableResult<Extension> searchResult = null;
  
          int currentOffset = query.getOffset() > 0 ? query.getOffset() : 0;
          int currentNb = query.getLimit();
  
          // A local index would avoid things like this...
          for (ExtensionRepository repository : repositories) {
              try {
                  searchResult = search(repository, query, currentOffset, currentNb, searchResult);
  
                  if (searchResult != null) {
                      if (currentOffset > 0) {
                          currentOffset = query.getOffset() - searchResult.getTotalHits();
                          if (currentOffset < 0) {
                              currentOffset = 0;
                          }
                      }
  
                      if (currentNb > 0) {
                          currentNb = query.getLimit() - searchResult.getSize();
                          if (currentNb < 0) {
                              currentNb = 0;
                          }
                      }
                  }
              } catch (SearchException e) {
                  LOGGER.error(
                      "Failed to search on repository [{}] with query [{}]. " + "Ignore and go to next repository.",
                      repository.getDescriptor().toString(), query, e);
              }
          }
  
          return searchResult != null ? searchResult
              : new CollectionIterableResult<>(0, query.getOffset(), Collections.<Extension>emptyList());
      }
docs: Search passed repositories based of the provided query.
  
  @param query the query
  @param repositories the repositories
  @return the found extensions descriptors, empty list if nothing could be found
  @throws SearchException error when trying to search provided query
  @since 10.0RC1