local_runtime_shared_jetty9/src/main/java/com/google/apphosting/utils/servlet/SearchServlet.java [367:418]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private void doGetDocument(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    // Empty namespace parameter equals to no namespace specified
    String requestedNamespace = req.getParameter(NAMESPACE);
    String namespace = requestedNamespace != null ? requestedNamespace : "";
    String indexName = req.getParameter(INDEX_NAME);
    String docId = req.getParameter(DOC_ID);

    Document doc = null;
    List<FieldView> fields = new ArrayList<FieldView>();

    try {
      SearchService search = SearchServiceFactory.getSearchService(namespace);
      Index index = search.getIndex(IndexSpec.newBuilder().setName(indexName));
      GetRequest getRequest = GetRequest.newBuilder()
          .setLimit(1)
          .setStartId(docId)
          .setIncludeStart(true)
          .build();
      GetResponse<Document> getResponse = index.getRange(getRequest);
      Iterator<Document> it = getResponse.iterator();

      if (it.hasNext()) {
        doc = it.next();
      }
      if (doc != null && docId.equals(doc.getId())) {
        for (Field field : doc.getFields()) {
          fields.add(new FieldView(field));
        }
      } else {
        doc = null;
        req.setAttribute(ERROR_MESSAGE, "Document is not found");
      }
    } catch (RuntimeException e) {
      logger.log(Level.SEVERE, "failed to retrieve document", e);
      req.setAttribute(ERROR_MESSAGE, makeErrorMessage(e.getMessage()));
    }

    setCommonAttributes(req, requestedNamespace);
    req.setAttribute(PREV_LINK, getPrevLink(req, String.format(
        "/_ah/admin/search?subsection=%s&namespace=%s&indexName=%s",
        Subsection.searchIndex.name(), requestedNamespace, indexName)));
    req.setAttribute(DOCUMENT, doc);
    req.setAttribute(FIELDS, fields);
    resp.setContentType("text/html; charset=UTF-8");

    try {
      getServletContext().getRequestDispatcher(
          "/_ah/adminConsole?subsection=" + Subsection.searchDocument.name()).forward(req, resp);
    } catch (ServletException e) {
      throw new RuntimeException("Could not forward request", e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



local_runtime_shared_jetty12/src/main/java/com/google/apphosting/utils/servlet/SearchServlet.java [367:418]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private void doGetDocument(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    // Empty namespace parameter equals to no namespace specified
    String requestedNamespace = req.getParameter(NAMESPACE);
    String namespace = requestedNamespace != null ? requestedNamespace : "";
    String indexName = req.getParameter(INDEX_NAME);
    String docId = req.getParameter(DOC_ID);

    Document doc = null;
    List<FieldView> fields = new ArrayList<FieldView>();

    try {
      SearchService search = SearchServiceFactory.getSearchService(namespace);
      Index index = search.getIndex(IndexSpec.newBuilder().setName(indexName));
      GetRequest getRequest = GetRequest.newBuilder()
          .setLimit(1)
          .setStartId(docId)
          .setIncludeStart(true)
          .build();
      GetResponse<Document> getResponse = index.getRange(getRequest);
      Iterator<Document> it = getResponse.iterator();

      if (it.hasNext()) {
        doc = it.next();
      }
      if (doc != null && docId.equals(doc.getId())) {
        for (Field field : doc.getFields()) {
          fields.add(new FieldView(field));
        }
      } else {
        doc = null;
        req.setAttribute(ERROR_MESSAGE, "Document is not found");
      }
    } catch (RuntimeException e) {
      logger.log(Level.SEVERE, "failed to retrieve document", e);
      req.setAttribute(ERROR_MESSAGE, makeErrorMessage(e.getMessage()));
    }

    setCommonAttributes(req, requestedNamespace);
    req.setAttribute(PREV_LINK, getPrevLink(req, String.format(
        "/_ah/admin/search?subsection=%s&namespace=%s&indexName=%s",
        Subsection.searchIndex.name(), requestedNamespace, indexName)));
    req.setAttribute(DOCUMENT, doc);
    req.setAttribute(FIELDS, fields);
    resp.setContentType("text/html; charset=UTF-8");

    try {
      getServletContext().getRequestDispatcher(
          "/_ah/adminConsole?subsection=" + Subsection.searchDocument.name()).forward(req, resp);
    } catch (ServletException e) {
      throw new RuntimeException("Could not forward request", e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



local_runtime_shared_jetty12/src/main/java/com/google/apphosting/utils/servlet/ee10/SearchServlet.java [367:418]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private void doGetDocument(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    // Empty namespace parameter equals to no namespace specified
    String requestedNamespace = req.getParameter(NAMESPACE);
    String namespace = requestedNamespace != null ? requestedNamespace : "";
    String indexName = req.getParameter(INDEX_NAME);
    String docId = req.getParameter(DOC_ID);

    Document doc = null;
    List<FieldView> fields = new ArrayList<FieldView>();

    try {
      SearchService search = SearchServiceFactory.getSearchService(namespace);
      Index index = search.getIndex(IndexSpec.newBuilder().setName(indexName));
      GetRequest getRequest = GetRequest.newBuilder()
          .setLimit(1)
          .setStartId(docId)
          .setIncludeStart(true)
          .build();
      GetResponse<Document> getResponse = index.getRange(getRequest);
      Iterator<Document> it = getResponse.iterator();

      if (it.hasNext()) {
        doc = it.next();
      }
      if (doc != null && docId.equals(doc.getId())) {
        for (Field field : doc.getFields()) {
          fields.add(new FieldView(field));
        }
      } else {
        doc = null;
        req.setAttribute(ERROR_MESSAGE, "Document is not found");
      }
    } catch (RuntimeException e) {
      logger.log(Level.SEVERE, "failed to retrieve document", e);
      req.setAttribute(ERROR_MESSAGE, makeErrorMessage(e.getMessage()));
    }

    setCommonAttributes(req, requestedNamespace);
    req.setAttribute(PREV_LINK, getPrevLink(req, String.format(
        "/_ah/admin/search?subsection=%s&namespace=%s&indexName=%s",
        Subsection.searchIndex.name(), requestedNamespace, indexName)));
    req.setAttribute(DOCUMENT, doc);
    req.setAttribute(FIELDS, fields);
    resp.setContentType("text/html; charset=UTF-8");

    try {
      getServletContext().getRequestDispatcher(
          "/_ah/adminConsole?subsection=" + Subsection.searchDocument.name()).forward(req, resp);
    } catch (ServletException e) {
      throw new RuntimeException("Could not forward request", e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



