class NpmSearchGroupHandler extends GroupHandler {

  @Override
  protected Response doGet(@Nonnull final Context context,
                           @Nonnull final DispatchedRepositories dispatched)
      throws Exception
  {
    checkNotNull(context);
    checkNotNull(dispatched);

    Request request = context.getRequest();
    Parameters parameters = request.getParameters();
    String text = npmSearchParameterExtractor.extractText(parameters);

    NpmSearchResponse response;
    if (text.isEmpty()) {
      response = npmSearchResponseFactory.buildEmptyResponse();
    }
    else {
      response = searchMembers(context, dispatched, parameters);
    }

    String content = npmSearchResponseMapper.writeString(response);
    return HttpResponses.ok(new StringPayload(content, ContentTypes.APPLICATION_JSON));
  }

  @Inject public  NpmSearchGroupHandler(final NpmSearchParameterExtractor npmSearchParameterExtractor,
                               final NpmSearchResponseFactory npmSearchResponseFactory,
                               final NpmSearchResponseMapper npmSearchResponseMapper,
                               @Named("${nexus.npm.v1SearchMaxResults:-250}") final int v1SearchMaxResults);

}