local_runtime_shared_jetty9/src/main/java/com/google/apphosting/utils/servlet/SearchServlet.java [313:365]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private void doGetIndex(HttpServletRequest req, HttpServletResponse resp)
      throws IOException {
    int start = getIntParam(req, START, 0);
    int numPerPage = getIntParam(req, NUM_PER_PAGE, 10);
    String indexName = req.getParameter(INDEX_NAME);
    String requestedNamespace = req.getParameter(NAMESPACE);
    String query = getStringParam(req, QUERY, "");

    // Empty namespace parameter equals to no namespace specified.
    String namespace = requestedNamespace != null ? requestedNamespace : "";

    try {
      SearchService search = SearchServiceFactory.getSearchService(namespace);
      Index index = search.getIndex(IndexSpec.newBuilder().setName(indexName));
      Query searchRequest = Query.newBuilder()
          .setOptions(QueryOptions.newBuilder()
              .setLimit(numPerPage)
              .setOffset(start))
          .build(query);
      Results<ScoredDocument> searchResponse = index.search(searchRequest);
      if (searchResponse.getOperationResult().getCode() == StatusCode.OK) {
        fillInSearchResults(req, searchResponse, start, numPerPage);
      } else {
        req.setAttribute(
            ERROR_MESSAGE, makeErrorMessage(searchResponse.getOperationResult().getMessage()));
      }
    } catch (RuntimeException e) {
      logger.log(Level.SEVERE, "failed to retrieve documents list", e);
      req.setAttribute(ERROR_MESSAGE, makeErrorMessage(e.getMessage()));
    }

    // Set common attributes.
    setCommonAttributes(req, requestedNamespace);
    req.setAttribute(INDEX_NAME, indexName);
    req.setAttribute(QUERY, query);
    req.setAttribute(
        START_BASE_URL,
        filterURL(req, SUBSECTION, NAMESPACE, INDEX_NAME, QUERY, NUM_PER_PAGE, PREV_LINK));
    req.setAttribute(PREV_LINK, getPrevLink(req, String.format(
        "/_ah/admin/search?namespace=%s", requestedNamespace)));
    req.setAttribute(CURRENT_LINK, urlencode(
        filterURL(req, SUBSECTION, NAMESPACE, INDEX_NAME, QUERY, START, NUM_PER_PAGE, PREV_LINK)));
    resp.setContentType("text/html; charset=UTF-8");

    String url = String.format(
        "/_ah/adminConsole?subsection=%s&indexName=%s&namespace=%s",
        Subsection.searchIndex.name(), indexName, namespace);
    try {
      getServletContext().getRequestDispatcher(url).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 [313:365]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private void doGetIndex(HttpServletRequest req, HttpServletResponse resp)
      throws IOException {
    int start = getIntParam(req, START, 0);
    int numPerPage = getIntParam(req, NUM_PER_PAGE, 10);
    String indexName = req.getParameter(INDEX_NAME);
    String requestedNamespace = req.getParameter(NAMESPACE);
    String query = getStringParam(req, QUERY, "");

    // Empty namespace parameter equals to no namespace specified.
    String namespace = requestedNamespace != null ? requestedNamespace : "";

    try {
      SearchService search = SearchServiceFactory.getSearchService(namespace);
      Index index = search.getIndex(IndexSpec.newBuilder().setName(indexName));
      Query searchRequest = Query.newBuilder()
          .setOptions(QueryOptions.newBuilder()
              .setLimit(numPerPage)
              .setOffset(start))
          .build(query);
      Results<ScoredDocument> searchResponse = index.search(searchRequest);
      if (searchResponse.getOperationResult().getCode() == StatusCode.OK) {
        fillInSearchResults(req, searchResponse, start, numPerPage);
      } else {
        req.setAttribute(
            ERROR_MESSAGE, makeErrorMessage(searchResponse.getOperationResult().getMessage()));
      }
    } catch (RuntimeException e) {
      logger.log(Level.SEVERE, "failed to retrieve documents list", e);
      req.setAttribute(ERROR_MESSAGE, makeErrorMessage(e.getMessage()));
    }

    // Set common attributes.
    setCommonAttributes(req, requestedNamespace);
    req.setAttribute(INDEX_NAME, indexName);
    req.setAttribute(QUERY, query);
    req.setAttribute(
        START_BASE_URL,
        filterURL(req, SUBSECTION, NAMESPACE, INDEX_NAME, QUERY, NUM_PER_PAGE, PREV_LINK));
    req.setAttribute(PREV_LINK, getPrevLink(req, String.format(
        "/_ah/admin/search?namespace=%s", requestedNamespace)));
    req.setAttribute(CURRENT_LINK, urlencode(
        filterURL(req, SUBSECTION, NAMESPACE, INDEX_NAME, QUERY, START, NUM_PER_PAGE, PREV_LINK)));
    resp.setContentType("text/html; charset=UTF-8");

    String url = String.format(
        "/_ah/adminConsole?subsection=%s&indexName=%s&namespace=%s",
        Subsection.searchIndex.name(), indexName, namespace);
    try {
      getServletContext().getRequestDispatcher(url).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 [313:365]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private void doGetIndex(HttpServletRequest req, HttpServletResponse resp)
      throws IOException {
    int start = getIntParam(req, START, 0);
    int numPerPage = getIntParam(req, NUM_PER_PAGE, 10);
    String indexName = req.getParameter(INDEX_NAME);
    String requestedNamespace = req.getParameter(NAMESPACE);
    String query = getStringParam(req, QUERY, "");

    // Empty namespace parameter equals to no namespace specified.
    String namespace = requestedNamespace != null ? requestedNamespace : "";

    try {
      SearchService search = SearchServiceFactory.getSearchService(namespace);
      Index index = search.getIndex(IndexSpec.newBuilder().setName(indexName));
      Query searchRequest = Query.newBuilder()
          .setOptions(QueryOptions.newBuilder()
              .setLimit(numPerPage)
              .setOffset(start))
          .build(query);
      Results<ScoredDocument> searchResponse = index.search(searchRequest);
      if (searchResponse.getOperationResult().getCode() == StatusCode.OK) {
        fillInSearchResults(req, searchResponse, start, numPerPage);
      } else {
        req.setAttribute(
            ERROR_MESSAGE, makeErrorMessage(searchResponse.getOperationResult().getMessage()));
      }
    } catch (RuntimeException e) {
      logger.log(Level.SEVERE, "failed to retrieve documents list", e);
      req.setAttribute(ERROR_MESSAGE, makeErrorMessage(e.getMessage()));
    }

    // Set common attributes.
    setCommonAttributes(req, requestedNamespace);
    req.setAttribute(INDEX_NAME, indexName);
    req.setAttribute(QUERY, query);
    req.setAttribute(
        START_BASE_URL,
        filterURL(req, SUBSECTION, NAMESPACE, INDEX_NAME, QUERY, NUM_PER_PAGE, PREV_LINK));
    req.setAttribute(PREV_LINK, getPrevLink(req, String.format(
        "/_ah/admin/search?namespace=%s", requestedNamespace)));
    req.setAttribute(CURRENT_LINK, urlencode(
        filterURL(req, SUBSECTION, NAMESPACE, INDEX_NAME, QUERY, START, NUM_PER_PAGE, PREV_LINK)));
    resp.setContentType("text/html; charset=UTF-8");

    String url = String.format(
        "/_ah/adminConsole?subsection=%s&indexName=%s&namespace=%s",
        Subsection.searchIndex.name(), indexName, namespace);
    try {
      getServletContext().getRequestDispatcher(url).forward(req, resp);
    } catch (ServletException e) {
      throw new RuntimeException("Could not forward request", e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



