code: public static IterableResult<Extension> search(ExtensionRepository repository, ExtensionQuery query,
          IterableResult<Extension> previousSearchResult) throws SearchException
      {
          IterableResult<Extension> result;
  
          if (repository instanceof Searchable) {
              if (repository instanceof AdvancedSearchable) {
                  AdvancedSearchable searchableRepository = (AdvancedSearchable) repository;
  
                  result = searchableRepository.search(query);
              } else {
                  Searchable searchableRepository = (Searchable) repository;
  
                  result = searchableRepository.search(query.getQuery(), query.getOffset(), query.getLimit());
              }
  
              if (previousSearchResult != null) {
                  result = RepositoryUtils.appendSearchResults(previousSearchResult, result);
              }
          } else {
              result = previousSearchResult;
          }
  
          return result;
      }
docs: Search one repository.
  
  @param repository the repository to search
  @param query the search query
  @param previousSearchResult the current search result merged from all previous repositories
  @return the updated maximum number of search results to return
  @throws SearchException error while searching on provided repository