docs: private final SearchQuery parseQueryString(final HttpQuery query, 
        final SearchType type) {
      final SearchQuery search_query = new SearchQuery();
      
      if (type == SearchType.LOOKUP) {
        final String query_string = query.getRequiredQueryStringParam("m");
        search_query.setTags(new ArrayList<Pair<String, String>>());
        
        try {
        search_query.setMetric(Tags.parseWithMetric(query_string, 
            search_query.getTags()));
        } catch (IllegalArgumentException e) {
          throw new BadRequestException("Unable to parse query", e);
        }
        if (query.hasQueryStringParam("limit")) {
          final String limit = query.getQueryStringParam("limit");
          try {
            search_query.setLimit(Integer.parseInt(limit));
          } catch (NumberFormatException e) {
            throw new BadRequestException(
                    "Unable to convert 'limit' to a valid number");
          }
        }
        return search_query;
      }
      
      // process a regular search query
      search_query.setQuery(query.getRequiredQueryStringParam("query"));
      
      if (query.hasQueryStringParam("limit")) {
        final String limit = query.getQueryStringParam("limit");
        try {
          search_query.setLimit(Integer.parseInt(limit));
        } catch (NumberFormatException e) {
          throw new BadRequestException(
              "Unable to convert 'limit' to a valid number");
        }
      }
      
      if (query.hasQueryStringParam("start_index")) {
        final String idx = query.getQueryStringParam("start_index");
        try {
          search_query.setStartIndex(Integer.parseInt(idx));
        } catch (NumberFormatException e) {
          throw new BadRequestException(
              "Unable to convert 'start_index' to a valid number");
        }
      }
      
      if (query.hasQueryStringParam("use_meta")) {
        search_query.setUseMeta(Boolean.parseBoolean(
            query.getQueryStringParam("use_meta")));
      }
      
      return search_query;
    }